From 2abef4aaaa30708cc2010abce52f2d3c49917af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 09:14:28 +0100 Subject: [PATCH 01/32] Switch CI to new docker --- .github/env | 2 +- .gitlab-ci.yml | 10 +++++----- docs/contributor/container.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/env b/.github/env index 730c37f1db80b..6d3f8e994cbab 100644 --- a/.github/env +++ b/.github/env @@ -1 +1 @@ -IMAGE="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" +IMAGE="docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42a7e87bda433..359aec73214e8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ workflow: variables: # CI_IMAGE: !reference [ .ci-unified, variables, CI_IMAGE ] - CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" + CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220" # BUILDAH_IMAGE is defined in group variables BUILDAH_COMMAND: "buildah --storage-driver overlay2" RELENG_SCRIPTS_BRANCH: "master" @@ -125,18 +125,18 @@ default: - cat .forklift/config-gitlab.toml > .forklift/config.toml - > if [ "$FORKLIFT_BYPASS" != "true" ]; then - echo "FORKLIFT_BYPASS not set"; + echo "FORKLIFT_BYPASS not set"; if command -v forklift >/dev/null 2>&1; then - echo "forklift already exists"; + echo "forklift already exists"; forklift version else echo "forklift does not exist, downloading"; - curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64"; + curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64"; chmod +x forklift; export PATH=$PATH:$(pwd); echo ${FL_FORKLIFT_VERSION}; fi - echo "Creating alias cargo='forklift cargo'"; + echo "Creating alias cargo='forklift cargo'"; shopt -s expand_aliases; alias cargo="forklift cargo"; fi diff --git a/docs/contributor/container.md b/docs/contributor/container.md index e387f568d7b51..bc05bf8b54a50 100644 --- a/docs/contributor/container.md +++ b/docs/contributor/container.md @@ -24,7 +24,7 @@ The command below allows building a Linux binary without having to even install docker run --rm -it \ -w /polkadot-sdk \ -v $(pwd):/polkadot-sdk \ - docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558 \ + docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220 \ cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain sudo chown -R $(id -u):$(id -g) target/ ``` From a40c1188e4daa0ed99e6861cf30b4a939e088302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 09:35:03 +0100 Subject: [PATCH 02/32] Allow non_local_definitions where needed --- cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs | 1 + cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 1 + .../parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 1 + .../runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs | 1 + .../runtimes/collectives/collectives-westend/src/lib.rs | 1 + .../parachains/runtimes/contracts/contracts-rococo/src/lib.rs | 1 + cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs | 1 + cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs | 1 + cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs | 1 + cumulus/parachains/runtimes/people/people-rococo/src/lib.rs | 1 + cumulus/parachains/runtimes/people/people-westend/src/lib.rs | 1 + cumulus/parachains/runtimes/testing/penpal/src/lib.rs | 1 + cumulus/polkadot-omni-node/lib/src/fake_runtime_api/utils.rs | 1 + polkadot/runtime/rococo/src/lib.rs | 1 + polkadot/runtime/westend/src/lib.rs | 1 + substrate/bin/node/runtime/src/lib.rs | 1 + templates/parachain/runtime/src/apis.rs | 1 + templates/solochain/runtime/src/apis.rs | 1 + 18 files changed, 18 insertions(+) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 43b7bf0ba1184..e6ba7a40bd8c2 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -1679,6 +1679,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 6e0fa19320dd2..d4611922ac22f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1875,6 +1875,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index fdba23a2915f4..662fa4b748e96 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -1081,6 +1081,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 45d08ba8546cd..c396f9670a212 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -971,6 +971,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index 79c240323878b..ae0cfacafaeb6 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -1083,6 +1083,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 5ad4026e0b2b4..0895619b6f022 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -780,6 +780,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 622a40e1d8dc0..96ee07b94b55f 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -948,6 +948,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 7312c9c1639d2..f9ceb3e51a131 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -940,6 +940,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs index 75f45297fe2cd..b9db515a1061b 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs @@ -459,6 +459,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index cb0282b17a6ce..b8a6394921ba0 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -896,6 +896,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index 050256dd4f6a3..423dcd7c4273f 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -894,6 +894,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index 095ae2ed9e962..5dfe5a7620b6c 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -1132,6 +1132,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/cumulus/polkadot-omni-node/lib/src/fake_runtime_api/utils.rs b/cumulus/polkadot-omni-node/lib/src/fake_runtime_api/utils.rs index 636c845271d54..858275d189a67 100644 --- a/cumulus/polkadot-omni-node/lib/src/fake_runtime_api/utils.rs +++ b/cumulus/polkadot-omni-node/lib/src/fake_runtime_api/utils.rs @@ -206,6 +206,7 @@ macro_rules! impl_node_runtime_apis { unimplemented!() } + #[allow(non_local_definitions)] fn dispatch_benchmark( _: frame_benchmarking::BenchmarkConfig ) -> Result, String> { diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 15d183c301a87..24750657c3e00 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -2463,6 +2463,7 @@ sp_api::impl_runtime_apis! { return (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig, ) -> Result< diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 3aa3e26d030e6..b0b52020d8c3c 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -2632,6 +2632,7 @@ sp_api::impl_runtime_apis! { return (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig, ) -> Result< diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index 3e11dcc674ec7..8be30e6f16a9f 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -3778,6 +3778,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/templates/parachain/runtime/src/apis.rs b/templates/parachain/runtime/src/apis.rs index d7da43b86af16..aac204cf39ce4 100644 --- a/templates/parachain/runtime/src/apis.rs +++ b/templates/parachain/runtime/src/apis.rs @@ -265,6 +265,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { diff --git a/templates/solochain/runtime/src/apis.rs b/templates/solochain/runtime/src/apis.rs index 9dc588c43a2d5..53cf1820fc792 100644 --- a/templates/solochain/runtime/src/apis.rs +++ b/templates/solochain/runtime/src/apis.rs @@ -241,6 +241,7 @@ impl_runtime_apis! { (list, storage_info) } + #[allow(non_local_definitions)] fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, alloc::string::String> { From f3a15f9035895081d7f40428c35383fd71afc88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 10:02:40 +0100 Subject: [PATCH 03/32] Make impl non local --- substrate/frame/babe/src/tests.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/frame/babe/src/tests.rs b/substrate/frame/babe/src/tests.rs index 5210d9289bcdb..bfcd3540ae3ef 100644 --- a/substrate/frame/babe/src/tests.rs +++ b/substrate/frame/babe/src/tests.rs @@ -35,6 +35,12 @@ const EMPTY_RANDOMNESS: [u8; RANDOMNESS_LENGTH] = [ 161, 164, 127, 217, 153, 138, 37, 48, 192, 248, 0, ]; +impl crate::migrations::BabePalletPrefix for Test { + fn pallet_prefix() -> &'static str { + "Babe" + } +} + #[test] fn empty_randomness_is_correct() { let s = compute_randomness([0; RANDOMNESS_LENGTH], 0, std::iter::empty(), None); @@ -943,12 +949,6 @@ fn valid_equivocation_reports_dont_pay_fees() { fn add_epoch_configurations_migration_works() { use frame_support::storage::migration::{get_storage_value, put_storage_value}; - impl crate::migrations::BabePalletPrefix for Test { - fn pallet_prefix() -> &'static str { - "Babe" - } - } - new_test_ext(1).execute_with(|| { let next_config_descriptor = NextConfigDescriptor::V1 { c: (3, 4), allowed_slots: AllowedSlots::PrimarySlots }; From d8b135225774afc9de83664494b108e86359089c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 10:12:04 +0100 Subject: [PATCH 04/32] Make macros non local --- substrate/frame/benchmarking/src/tests_instance.rs | 10 +++++----- substrate/primitives/core/src/lib.rs | 5 +++-- substrate/primitives/runtime/src/lib.rs | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/substrate/frame/benchmarking/src/tests_instance.rs b/substrate/frame/benchmarking/src/tests_instance.rs index 428f29e2bc161..11062813e33ce 100644 --- a/substrate/frame/benchmarking/src/tests_instance.rs +++ b/substrate/frame/benchmarking/src/tests_instance.rs @@ -86,6 +86,11 @@ frame_support::construct_runtime!( } ); +crate::define_benchmarks!( + [pallet_test, TestPallet] + [pallet_test, TestPallet2] +); + #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; @@ -187,11 +192,6 @@ mod benchmarks { fn ensure_correct_instance_is_selected() { use crate::utils::Benchmarking; - crate::define_benchmarks!( - [pallet_test, TestPallet] - [pallet_test, TestPallet2] - ); - let whitelist = vec![]; let mut batches = Vec::::new(); diff --git a/substrate/primitives/core/src/lib.rs b/substrate/primitives/core/src/lib.rs index 454f61df79419..6090d2ca1c6f2 100644 --- a/substrate/primitives/core/src/lib.rs +++ b/substrate/primitives/core/src/lib.rs @@ -470,16 +470,17 @@ macro_rules! generate_feature_enabled_macro { mod tests { use super::*; + generate_feature_enabled_macro!(if_test, test, $); + generate_feature_enabled_macro!(if_not_test, not(test), $); + #[test] #[should_panic] fn generate_feature_enabled_macro_panics() { - generate_feature_enabled_macro!(if_test, test, $); if_test!(panic!("This should panic")); } #[test] fn generate_feature_enabled_macro_works() { - generate_feature_enabled_macro!(if_not_test, not(test), $); if_not_test!(panic!("This should not panic")); } } diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index f0c8e50f1ba1e..52c2f3bb11649 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -1190,16 +1190,17 @@ mod tests { mod sp_core_tests { use super::*; + sp_core::generate_feature_enabled_macro!(if_test, test, $); + sp_core::generate_feature_enabled_macro!(if_not_test, not(test), $); + #[test] #[should_panic] fn generate_feature_enabled_macro_panics() { - sp_core::generate_feature_enabled_macro!(if_test, test, $); if_test!(panic!("This should panic")); } #[test] fn generate_feature_enabled_macro_works() { - sp_core::generate_feature_enabled_macro!(if_not_test, not(test), $); if_not_test!(panic!("This should not panic")); } } From df85056626457e8d721fdce1b8911cb7c5e86cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 10:23:26 +0100 Subject: [PATCH 05/32] Get rid of irrefutable matches --- bridges/modules/grandpa/src/lib.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 22a15ec4062f7..c2c1218418fb1 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -789,12 +789,9 @@ where pub fn synced_headers_grandpa_info() -> Vec>> { frame_system::Pallet::::read_events_no_consensus() .filter_map(|event| { - if let Event::::UpdatedBestFinalizedHeader { grandpa_info, .. } = - event.event.try_into().ok()? - { - return Some(grandpa_info) - } - None + let Event::::UpdatedBestFinalizedHeader { grandpa_info, .. } = + event.event.try_into().ok()?; + Some(grandpa_info) }) .collect() } From e341c121ab3caef57dbe9ec0b07e05aaaa50af24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 18:51:30 +0100 Subject: [PATCH 06/32] Remove code thats unsafe for no reason --- substrate/frame/support/src/traits/hooks.rs | 50 ++++++++++----------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/substrate/frame/support/src/traits/hooks.rs b/substrate/frame/support/src/traits/hooks.rs index 51209cb542467..bf54f237eb707 100644 --- a/substrate/frame/support/src/traits/hooks.rs +++ b/substrate/frame/support/src/traits/hooks.rs @@ -628,6 +628,8 @@ pub trait OnTimestampSet { #[cfg(test)] mod tests { use super::*; + use crate::parameter_types; + use alloc::vec::Vec; use sp_io::TestExternalities; #[cfg(feature = "try-runtime")] @@ -712,7 +714,9 @@ mod tests { #[test] fn on_idle_round_robin_works() { - static mut ON_IDLE_INVOCATION_ORDER: alloc::vec::Vec<&str> = alloc::vec::Vec::new(); + parameter_types! { + static OnIdleInvocationOrder: Vec<&'static str> = Vec::new(); + } struct Test1; struct Test2; @@ -720,49 +724,41 @@ mod tests { type TestTuple = (Test1, Test2, Test3); impl OnIdle for Test1 { fn on_idle(_n: u32, _weight: Weight) -> Weight { - unsafe { - ON_IDLE_INVOCATION_ORDER.push("Test1"); - } + OnIdleInvocationOrder::mutate(|o| o.push("Test1")); Weight::zero() } } impl OnIdle for Test2 { fn on_idle(_n: u32, _weight: Weight) -> Weight { - unsafe { - ON_IDLE_INVOCATION_ORDER.push("Test2"); - } + OnIdleInvocationOrder::mutate(|o| o.push("Test2")); Weight::zero() } } impl OnIdle for Test3 { fn on_idle(_n: u32, _weight: Weight) -> Weight { - unsafe { - ON_IDLE_INVOCATION_ORDER.push("Test3"); - } + OnIdleInvocationOrder::mutate(|o| o.push("Test3")); Weight::zero() } } - unsafe { - TestTuple::on_idle(0, Weight::zero()); - assert_eq!(ON_IDLE_INVOCATION_ORDER, ["Test1", "Test2", "Test3"].to_vec()); - ON_IDLE_INVOCATION_ORDER.clear(); + TestTuple::on_idle(0, Weight::zero()); + assert_eq!(OnIdleInvocationOrder::get(), ["Test1", "Test2", "Test3"].to_vec()); + OnIdleInvocationOrder::mutate(|o| o.clear()); - TestTuple::on_idle(1, Weight::zero()); - assert_eq!(ON_IDLE_INVOCATION_ORDER, ["Test2", "Test3", "Test1"].to_vec()); - ON_IDLE_INVOCATION_ORDER.clear(); + TestTuple::on_idle(1, Weight::zero()); + assert_eq!(OnIdleInvocationOrder::get(), ["Test2", "Test3", "Test1"].to_vec()); + OnIdleInvocationOrder::mutate(|o| o.clear()); - TestTuple::on_idle(2, Weight::zero()); - assert_eq!(ON_IDLE_INVOCATION_ORDER, ["Test3", "Test1", "Test2"].to_vec()); - ON_IDLE_INVOCATION_ORDER.clear(); + TestTuple::on_idle(2, Weight::zero()); + assert_eq!(OnIdleInvocationOrder::get(), ["Test3", "Test1", "Test2"].to_vec()); + OnIdleInvocationOrder::mutate(|o| o.clear()); - TestTuple::on_idle(3, Weight::zero()); - assert_eq!(ON_IDLE_INVOCATION_ORDER, ["Test1", "Test2", "Test3"].to_vec()); - ON_IDLE_INVOCATION_ORDER.clear(); + TestTuple::on_idle(3, Weight::zero()); + assert_eq!(OnIdleInvocationOrder::get(), ["Test1", "Test2", "Test3"].to_vec()); + OnIdleInvocationOrder::mutate(|o| o.clear()); - TestTuple::on_idle(4, Weight::zero()); - assert_eq!(ON_IDLE_INVOCATION_ORDER, ["Test2", "Test3", "Test1"].to_vec()); - ON_IDLE_INVOCATION_ORDER.clear(); - } + TestTuple::on_idle(4, Weight::zero()); + assert_eq!(OnIdleInvocationOrder::get(), ["Test2", "Test3", "Test1"].to_vec()); + OnIdleInvocationOrder::mutate(|o| o.clear()); } } From 3a15bb5ca6d6f9f70c919b00c2b05b142beefb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 19:05:04 +0100 Subject: [PATCH 07/32] Remove unnecessary lifetimes --- substrate/client/network/types/src/kad.rs | 2 +- substrate/client/network/types/src/multiaddr/protocol.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/substrate/client/network/types/src/kad.rs b/substrate/client/network/types/src/kad.rs index 72028d356dc78..e844f97674018 100644 --- a/substrate/client/network/types/src/kad.rs +++ b/substrate/client/network/types/src/kad.rs @@ -101,7 +101,7 @@ impl Record { /// Checks whether the record is expired w.r.t. the given `Instant`. pub fn is_expired(&self, now: Instant) -> bool { - self.expires.map_or(false, |t| now >= t) + self.expires.is_some_and(|t| now >= t) } } diff --git a/substrate/client/network/types/src/multiaddr/protocol.rs b/substrate/client/network/types/src/multiaddr/protocol.rs index aca3a31136860..35fcaa5493a47 100644 --- a/substrate/client/network/types/src/multiaddr/protocol.rs +++ b/substrate/client/network/types/src/multiaddr/protocol.rs @@ -66,14 +66,14 @@ pub enum Protocol<'a> { Wss(Cow<'a, str>), } -impl<'a> Display for Protocol<'a> { +impl Display for Protocol<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let protocol = LiteP2pProtocol::from(self.clone()); Display::fmt(&protocol, f) } } -impl<'a> From for Protocol<'a> { +impl From for Protocol<'_> { #[inline] fn from(addr: IpAddr) -> Self { match addr { @@ -83,14 +83,14 @@ impl<'a> From for Protocol<'a> { } } -impl<'a> From for Protocol<'a> { +impl From for Protocol<'_> { #[inline] fn from(addr: Ipv4Addr) -> Self { Protocol::Ip4(addr) } } -impl<'a> From for Protocol<'a> { +impl From for Protocol<'_> { #[inline] fn from(addr: Ipv6Addr) -> Self { Protocol::Ip6(addr) From dd868b18cfbf41c9c2f54aba5b7ba69b13bbc664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 19:11:55 +0100 Subject: [PATCH 08/32] Remove empty line triggering a lint --- substrate/frame/contracts/fixtures/contracts/crypto_hashes.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/substrate/frame/contracts/fixtures/contracts/crypto_hashes.rs b/substrate/frame/contracts/fixtures/contracts/crypto_hashes.rs index 35cc03f1e7237..69b1671bbe2f8 100644 --- a/substrate/frame/contracts/fixtures/contracts/crypto_hashes.rs +++ b/substrate/frame/contracts/fixtures/contracts/crypto_hashes.rs @@ -48,7 +48,6 @@ pub extern "C" fn deploy() {} /// | 2 | BLAKE2 | 256 | /// | 3 | BLAKE2 | 128 | /// --------------------------------- - #[no_mangle] #[polkavm_derive::polkavm_export] pub extern "C" fn call() { From 1c1e5356a649c52776f35e9ce232b24c1efd5b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 19:06:48 +0100 Subject: [PATCH 09/32] Don't manually implement div_ceil --- bridges/primitives/test-utils/src/lib.rs | 2 +- polkadot/runtime/parachains/src/coretime/migration.rs | 2 +- substrate/client/allocator/src/freeing_bump.rs | 4 ++-- substrate/frame/transaction-storage/src/lib.rs | 2 +- substrate/frame/utility/src/lib.rs | 4 +--- substrate/primitives/transaction-storage-proof/src/lib.rs | 2 +- substrate/primitives/trie/src/node_codec.rs | 6 ++---- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/bridges/primitives/test-utils/src/lib.rs b/bridges/primitives/test-utils/src/lib.rs index 9855c32a46895..ae3d85ccdf51f 100644 --- a/bridges/primitives/test-utils/src/lib.rs +++ b/bridges/primitives/test-utils/src/lib.rs @@ -110,7 +110,7 @@ pub fn make_justification_for_header( ); // Roughly, how many vote ancestries do we want per fork - let target_depth = (ancestors + forks - 1) / forks; + let target_depth = ancestors.div_ceil(forks); let mut unsigned_precommits = vec![]; for i in 0..forks { diff --git a/polkadot/runtime/parachains/src/coretime/migration.rs b/polkadot/runtime/parachains/src/coretime/migration.rs index c3a1ebe824324..cd44451a7c392 100644 --- a/polkadot/runtime/parachains/src/coretime/migration.rs +++ b/polkadot/runtime/parachains/src/coretime/migration.rs @@ -250,7 +250,7 @@ mod v_coretime { return None }, }; - let time_slice = (valid_until + TIMESLICE_PERIOD - 1) / TIMESLICE_PERIOD; + let time_slice = valid_until.div_ceil(TIMESLICE_PERIOD); log::trace!(target: "coretime-migration", "Sending of lease holding para {:?}, valid_until: {:?}, time_slice: {:?}", p, valid_until, time_slice); Some(mk_coretime_call::(crate::coretime::CoretimeCalls::SetLease(p.into(), time_slice))) }); diff --git a/substrate/client/allocator/src/freeing_bump.rs b/substrate/client/allocator/src/freeing_bump.rs index 405916adc3c3f..f98e540b18c5b 100644 --- a/substrate/client/allocator/src/freeing_bump.rs +++ b/substrate/client/allocator/src/freeing_bump.rs @@ -350,7 +350,7 @@ pub struct AllocationStats { /// /// Returns `None` if the number of pages to not fit into `u32`. fn pages_from_size(size: u64) -> Option { - u32::try_from((size + PAGE_SIZE as u64 - 1) / PAGE_SIZE as u64).ok() + u32::try_from(size.div_ceil(PAGE_SIZE as u64)).ok() } /// An implementation of freeing bump allocator. @@ -378,7 +378,7 @@ impl FreeingBumpHeapAllocator { /// /// - `heap_base` - the offset from the beginning of the linear memory where the heap starts. pub fn new(heap_base: u32) -> Self { - let aligned_heap_base = (heap_base + ALIGNMENT - 1) / ALIGNMENT * ALIGNMENT; + let aligned_heap_base = heap_base.div_ceil(ALIGNMENT) * ALIGNMENT; FreeingBumpHeapAllocator { original_heap_base: aligned_heap_base, diff --git a/substrate/frame/transaction-storage/src/lib.rs b/substrate/frame/transaction-storage/src/lib.rs index 68f24526300d8..1fa5109ad6178 100644 --- a/substrate/frame/transaction-storage/src/lib.rs +++ b/substrate/frame/transaction-storage/src/lib.rs @@ -85,7 +85,7 @@ pub struct TransactionInfo { } fn num_chunks(bytes: u32) -> u32 { - ((bytes as u64 + CHUNK_SIZE as u64 - 1) / CHUNK_SIZE as u64) as u32 + (bytes as u64).div_ceil(CHUNK_SIZE as u64) as u32 } #[frame_support::pallet] diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 26c38d1f0459d..90828ac7f66da 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -133,9 +133,7 @@ pub mod pallet { /// The limit on the number of batched calls. fn batched_calls_limit() -> u32 { let allocator_limit = sp_core::MAX_POSSIBLE_ALLOCATION; - let call_size = ((core::mem::size_of::<::RuntimeCall>() as u32 + - CALL_ALIGN - 1) / - CALL_ALIGN) * CALL_ALIGN; + let call_size = (core::mem::size_of::<::RuntimeCall>() as u32).div_ceil(CALL_ALIGN) * CALL_ALIGN; // The margin to take into account vec doubling capacity. let margin_factor = 3; diff --git a/substrate/primitives/transaction-storage-proof/src/lib.rs b/substrate/primitives/transaction-storage-proof/src/lib.rs index 893b2e33bee6c..2946fb3cc079b 100644 --- a/substrate/primitives/transaction-storage-proof/src/lib.rs +++ b/substrate/primitives/transaction-storage-proof/src/lib.rs @@ -191,7 +191,7 @@ pub mod registration { let total_chunks: u64 = transactions .iter() - .map(|t| ((t.len() + CHUNK_SIZE - 1) / CHUNK_SIZE) as u64) + .map(|t| t.len().div_ceil(CHUNK_SIZE) as u64) .sum(); let mut buf = [0u8; 8]; buf.copy_from_slice(&random_hash[0..8]); diff --git a/substrate/primitives/trie/src/node_codec.rs b/substrate/primitives/trie/src/node_codec.rs index 400f57f3b1bfe..c9d2c29468372 100644 --- a/substrate/primitives/trie/src/node_codec.rs +++ b/substrate/primitives/trie/src/node_codec.rs @@ -119,8 +119,7 @@ where return Err(Error::BadFormat) } let partial = input.take( - (nibble_count + (nibble_ops::NIBBLE_PER_BYTE - 1)) / - nibble_ops::NIBBLE_PER_BYTE, + nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE), )?; let partial_padding = nibble_ops::number_padding(nibble_count); let bitmap_range = input.take(BITMAP_LENGTH)?; @@ -167,8 +166,7 @@ where return Err(Error::BadFormat) } let partial = input.take( - (nibble_count + (nibble_ops::NIBBLE_PER_BYTE - 1)) / - nibble_ops::NIBBLE_PER_BYTE, + nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE), )?; let partial_padding = nibble_ops::number_padding(nibble_count); let value = if contains_hash { From efbbb7c8a31590f395a47522275f479ea5a06b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 19:56:43 +0100 Subject: [PATCH 10/32] As bytes not required --- substrate/primitives/runtime-interface/test-wasm/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs index 545f1ff4a115e..f0b9d6839d412 100644 --- a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs +++ b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs @@ -83,7 +83,7 @@ pub trait TestApi { /// Copy `hello` into the given mutable reference fn return_value_into_mutable_reference(&self, data: &mut [u8]) { let res = "hello"; - data[..res.as_bytes().len()].copy_from_slice(res.as_bytes()); + data[..res.len()].copy_from_slice(res.as_bytes()); } /// Returns the input data wrapped in an `Option` as result. From 1a5cd6c51d64bec630cbfa2856f8900d4e825a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Fri, 14 Feb 2025 20:05:09 +0100 Subject: [PATCH 11/32] Map_Or is not required --- substrate/frame/migrations/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/migrations/src/lib.rs b/substrate/frame/migrations/src/lib.rs index fef61468e6e4e..c5f37735d52db 100644 --- a/substrate/frame/migrations/src/lib.rs +++ b/substrate/frame/migrations/src/lib.rs @@ -762,7 +762,7 @@ impl Pallet { Self::deposit_event(Event::MigrationAdvanced { index: cursor.index, took }); cursor.inner_cursor = Some(bound_next_cursor); - if max_steps.map_or(false, |max| took > max.into()) { + if max_steps.is_some_and(|max| took > max.into()) { Self::deposit_event(Event::MigrationFailed { index: cursor.index, took }); Self::upgrade_failed(Some(cursor.index)); None From f53bef31bc09986564336ea137484585079dfe3a Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2025 19:16:25 +0000 Subject: [PATCH 12/32] Update from athei running command 'fmt --clean' --- substrate/frame/utility/src/lib.rs | 4 +++- substrate/primitives/transaction-storage-proof/src/lib.rs | 6 ++---- substrate/primitives/trie/src/node_codec.rs | 8 ++------ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 90828ac7f66da..c350a520c5cc6 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -133,7 +133,9 @@ pub mod pallet { /// The limit on the number of batched calls. fn batched_calls_limit() -> u32 { let allocator_limit = sp_core::MAX_POSSIBLE_ALLOCATION; - let call_size = (core::mem::size_of::<::RuntimeCall>() as u32).div_ceil(CALL_ALIGN) * CALL_ALIGN; + let call_size = (core::mem::size_of::<::RuntimeCall>() as u32) + .div_ceil(CALL_ALIGN) * + CALL_ALIGN; // The margin to take into account vec doubling capacity. let margin_factor = 3; diff --git a/substrate/primitives/transaction-storage-proof/src/lib.rs b/substrate/primitives/transaction-storage-proof/src/lib.rs index 2946fb3cc079b..9cfa6e166b201 100644 --- a/substrate/primitives/transaction-storage-proof/src/lib.rs +++ b/substrate/primitives/transaction-storage-proof/src/lib.rs @@ -189,10 +189,8 @@ pub mod registration { let mut target_chunk_key = Default::default(); let mut chunk_proof = Default::default(); - let total_chunks: u64 = transactions - .iter() - .map(|t| t.len().div_ceil(CHUNK_SIZE) as u64) - .sum(); + let total_chunks: u64 = + transactions.iter().map(|t| t.len().div_ceil(CHUNK_SIZE) as u64).sum(); let mut buf = [0u8; 8]; buf.copy_from_slice(&random_hash[0..8]); let random_u64 = u64::from_be_bytes(buf); diff --git a/substrate/primitives/trie/src/node_codec.rs b/substrate/primitives/trie/src/node_codec.rs index c9d2c29468372..1b6a816589177 100644 --- a/substrate/primitives/trie/src/node_codec.rs +++ b/substrate/primitives/trie/src/node_codec.rs @@ -118,9 +118,7 @@ where if padding && nibble_ops::pad_left(data[input.offset]) != 0 { return Err(Error::BadFormat) } - let partial = input.take( - nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE), - )?; + let partial = input.take(nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE))?; let partial_padding = nibble_ops::number_padding(nibble_count); let bitmap_range = input.take(BITMAP_LENGTH)?; let bitmap = Bitmap::decode(&data[bitmap_range])?; @@ -165,9 +163,7 @@ where if padding && nibble_ops::pad_left(data[input.offset]) != 0 { return Err(Error::BadFormat) } - let partial = input.take( - nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE), - )?; + let partial = input.take(nibble_count.div_ceil(nibble_ops::NIBBLE_PER_BYTE))?; let partial_padding = nibble_ops::number_padding(nibble_count); let value = if contains_hash { ValuePlan::Node(input.take(H::LENGTH)?) From 85d33ad2b107974346dbb3a67a3ce6c580624fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 10:22:39 +0100 Subject: [PATCH 13/32] Remove toolchain file for fixtures --- substrate/frame/revive/fixtures/Cargo.toml | 1 + substrate/frame/revive/fixtures/build.rs | 5 ----- substrate/frame/revive/fixtures/build/_rust-toolchain.toml | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 substrate/frame/revive/fixtures/build/_rust-toolchain.toml diff --git a/substrate/frame/revive/fixtures/Cargo.toml b/substrate/frame/revive/fixtures/Cargo.toml index a6f25cc26f3c0..22ba98edbd3e9 100644 --- a/substrate/frame/revive/fixtures/Cargo.toml +++ b/substrate/frame/revive/fixtures/Cargo.toml @@ -7,6 +7,7 @@ license.workspace = true description = "Fixtures for testing and benchmarking" homepage.workspace = true repository.workspace = true +rust-version = "1.84" [package.metadata.polkadot-sdk] exclude-from-umbrella = true diff --git a/substrate/frame/revive/fixtures/build.rs b/substrate/frame/revive/fixtures/build.rs index fe420ba40da63..38d3b6439ec0e 100644 --- a/substrate/frame/revive/fixtures/build.rs +++ b/substrate/frame/revive/fixtures/build.rs @@ -109,11 +109,6 @@ fn create_cargo_toml<'a>( let cargo_toml = toml::to_string_pretty(&cargo_toml)?; fs::write(output_dir.join("Cargo.toml"), cargo_toml.clone()) .with_context(|| format!("Failed to write {cargo_toml:?}"))?; - fs::copy( - fixtures_dir.join("build/_rust-toolchain.toml"), - output_dir.join("rust-toolchain.toml"), - ) - .context("Failed to write toolchain file")?; Ok(()) } diff --git a/substrate/frame/revive/fixtures/build/_rust-toolchain.toml b/substrate/frame/revive/fixtures/build/_rust-toolchain.toml deleted file mode 100644 index 4c757c708d58b..0000000000000 --- a/substrate/frame/revive/fixtures/build/_rust-toolchain.toml +++ /dev/null @@ -1,4 +0,0 @@ -[toolchain] -channel = "nightly-2024-11-19" -components = ["rust-src"] -profile = "minimal" From 4481424d2bdfcec1845da77382aba6e917075e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 12:03:28 +0100 Subject: [PATCH 14/32] Add missing documentation --- .../node/network/statement-distribution/src/v2/tests/mod.rs | 1 + substrate/client/merkle-mountain-range/src/test_utils.rs | 5 +++++ substrate/client/rpc-spec-v2/src/chain_head/test_utils.rs | 6 ++++++ substrate/primitives/state-machine/src/ext.rs | 1 + 4 files changed, 13 insertions(+) diff --git a/polkadot/node/network/statement-distribution/src/v2/tests/mod.rs b/polkadot/node/network/statement-distribution/src/v2/tests/mod.rs index 5a9b8efa2a13b..da3715e387334 100644 --- a/polkadot/node/network/statement-distribution/src/v2/tests/mod.rs +++ b/polkadot/node/network/statement-distribution/src/v2/tests/mod.rs @@ -776,6 +776,7 @@ async fn answer_expected_hypothetical_membership_request( ) } +/// Assert that the correct peer is reported. #[macro_export] macro_rules! assert_peer_reported { ($virtual_overseer:expr, $peer_id:expr, $rep_change:expr $(,)*) => { diff --git a/substrate/client/merkle-mountain-range/src/test_utils.rs b/substrate/client/merkle-mountain-range/src/test_utils.rs index 3b0506ef55d32..79879cc09a79e 100644 --- a/substrate/client/merkle-mountain-range/src/test_utils.rs +++ b/substrate/client/merkle-mountain-range/src/test_utils.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +//! Test utilities. + use crate::MmrGadget; use parking_lot::Mutex; use sc_block_builder::BlockBuilderBuilder; @@ -67,9 +69,12 @@ pub(crate) struct MmrBlock { pub(crate) leaf_data: Vec, } +/// Which kind of key type to use. #[derive(Clone, Copy)] pub enum OffchainKeyType { + /// Temporary key. Temp, + /// Cononical key. Canon, } diff --git a/substrate/client/rpc-spec-v2/src/chain_head/test_utils.rs b/substrate/client/rpc-spec-v2/src/chain_head/test_utils.rs index fa10fde388f97..48259f10ffc07 100644 --- a/substrate/client/rpc-spec-v2/src/chain_head/test_utils.rs +++ b/substrate/client/rpc-spec-v2/src/chain_head/test_utils.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +//! Test utilities. + use parking_lot::Mutex; use sc_client_api::{ execution_extensions::ExecutionExtensions, BlockBackend, BlockImportNotification, @@ -36,6 +38,7 @@ use sp_version::RuntimeVersion; use std::sync::Arc; use substrate_test_runtime::{Block, Hash, Header, H256}; +/// A mock client used for testing. pub struct ChainHeadMockClient { client: Arc, import_sinks: Mutex>>>, @@ -44,6 +47,7 @@ pub struct ChainHeadMockClient { } impl ChainHeadMockClient { + /// Create a new mock client. pub fn new(client: Arc) -> Self { ChainHeadMockClient { client, @@ -53,6 +57,7 @@ impl ChainHeadMockClient { } } + /// Trigger the import stram from a header. pub async fn trigger_import_stream(&self, header: Header) { // Ensure the client called the `import_notification_stream`. while self.import_sinks.lock().is_empty() { @@ -69,6 +74,7 @@ impl ChainHeadMockClient { } } + /// Trigger the import stram from a header and a list of stale heads. pub async fn trigger_finality_stream(&self, header: Header, stale_heads: Vec) { // Ensure the client called the `finality_notification_stream`. while self.finality_sinks.lock().is_empty() { diff --git a/substrate/primitives/state-machine/src/ext.rs b/substrate/primitives/state-machine/src/ext.rs index baad7e621bedc..afd0eeb1a55cd 100644 --- a/substrate/primitives/state-machine/src/ext.rs +++ b/substrate/primitives/state-machine/src/ext.rs @@ -139,6 +139,7 @@ where H::Out: Ord + 'static, B: 'a + Backend, { + /// Return all storage pairs from the backend and overlay combined. pub fn storage_pairs(&mut self) -> Vec<(StorageKey, StorageValue)> { use std::collections::HashMap; From 34a7ce7f0f3fd8b91d429275cd909a06fb6ae6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 14:18:01 +0100 Subject: [PATCH 15/32] Silence warnings in doc or test code arising from FRAME macro referenced non existent features --- bridges/relays/lib-substrate-relay/src/messages/mod.rs | 1 + docs/sdk/src/lib.rs | 2 ++ polkadot/xcm/docs/src/lib.rs | 2 ++ polkadot/xcm/xcm-simulator/example/src/lib.rs | 5 +++++ polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs | 5 +++++ .../test-staking-e2e/src/lib.rs | 3 +++ substrate/frame/node-authorization/src/lib.rs | 2 ++ .../frame/nomination-pools/test-delegate-stake/src/lib.rs | 2 ++ substrate/frame/scored-pool/src/lib.rs | 2 ++ substrate/frame/statement/src/lib.rs | 2 ++ 10 files changed, 26 insertions(+) diff --git a/bridges/relays/lib-substrate-relay/src/messages/mod.rs b/bridges/relays/lib-substrate-relay/src/messages/mod.rs index b4ee57ed7742e..8d22c0c843917 100644 --- a/bridges/relays/lib-substrate-relay/src/messages/mod.rs +++ b/bridges/relays/lib-substrate-relay/src/messages/mod.rs @@ -820,6 +820,7 @@ mod tests { } // mock runtime with `pallet_bridge_messages` + #[allow(unexpected_cfgs)] mod mock { use super::super::*; use bp_messages::{target_chain::ForbidInboundMessages, HashedLaneId}; diff --git a/docs/sdk/src/lib.rs b/docs/sdk/src/lib.rs index d96239ca89424..c1aefe435354d 100644 --- a/docs/sdk/src/lib.rs +++ b/docs/sdk/src/lib.rs @@ -23,6 +23,8 @@ #![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")] #![warn(rustdoc::broken_intra_doc_links)] #![warn(rustdoc::private_intra_doc_links)] +// Frame macros reference features which this crate does not have +#![allow(unexpected_cfgs)] #![doc(html_favicon_url = "https://polkadot.com/favicon.ico")] #![doc( html_logo_url = "https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png" diff --git a/polkadot/xcm/docs/src/lib.rs b/polkadot/xcm/docs/src/lib.rs index 8d78b9b19452d..77823cad3fd2c 100644 --- a/polkadot/xcm/docs/src/lib.rs +++ b/polkadot/xcm/docs/src/lib.rs @@ -50,6 +50,8 @@ //! //! ## Docs structure #![doc = simple_mermaid::mermaid!("../mermaid/structure.mmd")] +// Frame macros reference features which this crate does not have +#![allow(unexpected_cfgs)] /// Fundamentals of the XCM language. The virtual machine, instructions, locations and assets. pub mod fundamentals; diff --git a/polkadot/xcm/xcm-simulator/example/src/lib.rs b/polkadot/xcm/xcm-simulator/example/src/lib.rs index 8a05569831b5c..7d179bd258714 100644 --- a/polkadot/xcm/xcm-simulator/example/src/lib.rs +++ b/polkadot/xcm/xcm-simulator/example/src/lib.rs @@ -14,7 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod parachain; + +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod relay_chain; #[cfg(test)] diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs index 8ea5e033f3ad7..c49804310dd32 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs @@ -14,7 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod parachain; + +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod relay_chain; use codec::DecodeLimit; diff --git a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs index b1029e89fe85f..e232fc228f3fd 100644 --- a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/lib.rs @@ -16,6 +16,9 @@ // limitations under the License. #![cfg(test)] + +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod mock; pub(crate) const LOG_TARGET: &str = "tests::e2e-epm"; diff --git a/substrate/frame/node-authorization/src/lib.rs b/substrate/frame/node-authorization/src/lib.rs index 3cec0d3bcb63d..4fbb9555deeb2 100644 --- a/substrate/frame/node-authorization/src/lib.rs +++ b/substrate/frame/node-authorization/src/lib.rs @@ -38,6 +38,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod mock; #[cfg(test)] mod tests; diff --git a/substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs b/substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs index b43a41cd0f980..cabffa45461df 100644 --- a/substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs +++ b/substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs @@ -17,6 +17,8 @@ #![cfg(test)] +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod mock; use frame_support::{ diff --git a/substrate/frame/scored-pool/src/lib.rs b/substrate/frame/scored-pool/src/lib.rs index c4464bbbfac04..fcaa6950110a8 100644 --- a/substrate/frame/scored-pool/src/lib.rs +++ b/substrate/frame/scored-pool/src/lib.rs @@ -93,6 +93,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod mock; #[cfg(test)] diff --git a/substrate/frame/statement/src/lib.rs b/substrate/frame/statement/src/lib.rs index 6a7f577ab0869..02eef2ca1b2c6 100644 --- a/substrate/frame/statement/src/lib.rs +++ b/substrate/frame/statement/src/lib.rs @@ -45,6 +45,8 @@ use sp_statement_store::{ }; #[cfg(test)] +// We do not declare all features used by `construct_runtime` +#[allow(unexpected_cfgs)] mod mock; #[cfg(test)] mod tests; From a485b1d0d7c239b7e6592dda1c2155c31447087f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 14:52:05 +0100 Subject: [PATCH 16/32] Silence warning coming from external orchestra crate --- polkadot/node/overseer/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polkadot/node/overseer/src/lib.rs b/polkadot/node/overseer/src/lib.rs index a8d0ab90f6b91..92989e2b520e9 100644 --- a/polkadot/node/overseer/src/lib.rs +++ b/polkadot/node/overseer/src/lib.rs @@ -60,7 +60,8 @@ // unused dependencies can not work for test and examples at the same time // yielding false positives #![warn(missing_docs)] -#![allow(dead_code)] // TODO https://github.com/paritytech/polkadot-sdk/issues/5793 +// TODO https://github.com/paritytech/polkadot-sdk/issues/5793 +#![allow(dead_code, irrefutable_let_patterns)] use std::{ collections::{hash_map, HashMap}, From 55862cf4355550793eac0ace3ec939134f6d6fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 15:08:00 +0100 Subject: [PATCH 17/32] Replace redundant map_or --- substrate/frame/parameters/src/tests/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/parameters/src/tests/mock.rs b/substrate/frame/parameters/src/tests/mock.rs index 8d6f7d25ceac5..b7c391f383c22 100644 --- a/substrate/frame/parameters/src/tests/mock.rs +++ b/substrate/frame/parameters/src/tests/mock.rs @@ -107,7 +107,7 @@ mod custom_origin { ) -> Result { // Account 123 is allowed to set parameters in benchmarking only: #[cfg(feature = "runtime-benchmarks")] - if ensure_signed(origin.clone()).map_or(false, |acc| acc == 123) { + if ensure_signed(origin.clone()).is_ok_and(|acc| acc == 123) { return Ok(()); } From 48d739ee0d87b49161dc592622433b25959a6e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 15:42:49 +0100 Subject: [PATCH 18/32] Add missing feature --- substrate/frame/support/test/Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/substrate/frame/support/test/Cargo.toml b/substrate/frame/support/test/Cargo.toml index ca122e6bd5446..bc10ddd6aff0f 100644 --- a/substrate/frame/support/test/Cargo.toml +++ b/substrate/frame/support/test/Cargo.toml @@ -60,6 +60,12 @@ std = [ "test-pallet/std", ] experimental = ["frame-support/experimental", "frame-system/experimental"] +runtime-benchmarks = [ + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] try-runtime = [ "frame-executive/try-runtime", "frame-support/try-runtime", From 0fa3eefe44e955e5b568e142d853bbb7dd39875c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 15:54:41 +0100 Subject: [PATCH 19/32] Update UI tests --- .../tests/benchmark_ui/invalid_origin.stderr | 2 +- .../deprecated_where_block.stderr | 31 ++++++++++--------- .../call_argument_invalid_bound.stderr | 2 +- .../call_argument_invalid_bound_2.stderr | 6 ++-- .../call_argument_invalid_bound_3.stderr | 2 +- ...ev_mode_without_arg_max_encoded_len.stderr | 2 +- .../pallet_ui/event_field_not_member.stderr | 2 +- .../tests/pallet_ui/hooks_invalid_item.stderr | 4 ++- ...age_ensure_span_are_ok_on_wrong_gen.stderr | 20 ++++++------ ...re_span_are_ok_on_wrong_gen_unnamed.stderr | 20 ++++++------ .../pallet_ui/storage_info_unsatisfied.stderr | 2 +- .../storage_info_unsatisfied_nmap.stderr | 6 ++-- ...reference_in_impl_runtime_apis_call.stderr | 4 --- .../tests/ui/no_feature_gated_method.stderr | 7 ++--- 14 files changed, 56 insertions(+), 54 deletions(-) diff --git a/substrate/frame/support/test/tests/benchmark_ui/invalid_origin.stderr b/substrate/frame/support/test/tests/benchmark_ui/invalid_origin.stderr index 30f1289767fc5..87d4f476a60d1 100644 --- a/substrate/frame/support/test/tests/benchmark_ui/invalid_origin.stderr +++ b/substrate/frame/support/test/tests/benchmark_ui/invalid_origin.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `::RuntimeOrigin: --> tests/benchmark_ui/invalid_origin.rs:23:1 | 23 | #[benchmarks] - | ^^^^^^^^^^^^^ the trait `From<{integer}>` is not implemented for `::RuntimeOrigin`, which is required by `{integer}: Into<_>` + | ^^^^^^^^^^^^^ the trait `From<{integer}>` is not implemented for `::RuntimeOrigin` | = note: required for `{integer}` to implement `Into<::RuntimeOrigin>` = note: this error originates in the attribute macro `benchmarks` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr index 3b0bf05bd4e72..b468b8647ca19 100644 --- a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr +++ b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr @@ -86,7 +86,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: Callable` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `Callable` is implemented for `Pallet` = note: required for `Pallet` to implement `Callable` @@ -237,7 +237,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `&frame_system::Event: std::fmt::Debug` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `std::fmt::Debug` is implemented for `frame_system::Event` = note: required for `frame_system::Event` to implement `std::fmt::Debug` @@ -256,7 +256,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `&frame_system::Error: std::fmt::Debug` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `std::fmt::Debug` is implemented for `frame_system::Error` = note: required for `frame_system::Error` to implement `std::fmt::Debug` @@ -295,7 +295,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `RawOrigin<_>: Into<_>` + | |_^ the trait `Config` is not implemented for `Runtime` | = note: required for `RawOrigin<_>` to implement `Into` = note: this error originates in the macro `frame_support::construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -344,7 +344,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: PalletInfoAccess` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `PalletInfoAccess` is implemented for `Pallet` = note: required for `Pallet` to implement `PalletInfoAccess` @@ -360,7 +360,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: Callable` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `Callable` is implemented for `Pallet` = note: required for `Pallet` to implement `Callable` @@ -376,7 +376,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: Callable` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `Callable` is implemented for `Pallet` = note: required for `Pallet` to implement `Callable` @@ -466,7 +466,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: Callable` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `Callable` is implemented for `Pallet` = note: required for `Pallet` to implement `Callable` @@ -569,7 +569,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied --> tests/construct_runtime_ui/deprecated_where_block.rs:26:3 | 26 | System: frame_system::{Pallet, Call, Storage, Config, Event}, - | ^^^^^^ the trait `Config` is not implemented for `Runtime`, which is required by `Pallet: ViewFunctionIdPrefix` + | ^^^^^^ the trait `Config` is not implemented for `Runtime` | = help: the trait `ViewFunctionIdPrefix` is implemented for `Pallet` = note: required for `Pallet` to implement `ViewFunctionIdPrefix` @@ -784,7 +784,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `GenesisConfig: Serialize` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the trait `Serialize` is implemented for `GenesisConfig` = note: required for `GenesisConfig` to implement `Serialize` @@ -846,10 +846,13 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `GenesisConfig: std::default::Default` + | |_^ the trait `Config` is not implemented for `Runtime` + | +note: required by a bound in `GenesisConfig` + --> $WORKSPACE/substrate/frame/system/src/lib.rs | - = help: the trait `std::default::Default` is implemented for `GenesisConfig` - = note: required for `GenesisConfig` to implement `std::default::Default` + | pub struct GenesisConfig { + | ^^^^^^ required by this bound in `GenesisConfig` = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Runtime: Config` is not satisfied @@ -862,7 +865,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied ... | 27 | | } 28 | | } - | |_^ the trait `Config` is not implemented for `Runtime`, which is required by `(Pallet,): OnGenesis` + | |_^ the trait `Config` is not implemented for `Runtime` | = help: the following other types implement trait `OnGenesis`: () diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr index 1f91f77402386..883740ea92457 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr @@ -18,7 +18,7 @@ error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `::Bar`, which is required by `&::Bar: std::fmt::Debug` + = help: the trait `std::fmt::Debug` is not implemented for `::Bar` = note: required for `&::Bar` to implement `std::fmt::Debug` = note: required for the cast from `&&::Bar` to `&dyn std::fmt::Debug` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr index 4657c0a0c601f..999f9fea87251 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr @@ -18,7 +18,7 @@ error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `::Bar`, which is required by `&::Bar: std::fmt::Debug` + = help: the trait `std::fmt::Debug` is not implemented for `::Bar` = note: required for `&::Bar` to implement `std::fmt::Debug` = note: required for the cast from `&&::Bar` to `&dyn std::fmt::Debug` @@ -41,7 +41,7 @@ error[E0277]: the trait bound `::Bar: Encode` is not satisf | ------------------------ required by a bound introduced by this call ... 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { - | ^^^^ the trait `WrapperTypeEncode` is not implemented for `::Bar`, which is required by `::Bar: Encode` + | ^^^^ the trait `WrapperTypeEncode` is not implemented for `::Bar` | = note: required for `::Bar` to implement `Encode` @@ -49,7 +49,7 @@ error[E0277]: the trait bound `::Bar: Decode` is not satisf --> tests/pallet_ui/call_argument_invalid_bound_2.rs:38:42 | 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { - | ^^^^^^ the trait `WrapperTypeDecode` is not implemented for `::Bar`, which is required by `::Bar: Decode` + | ^^^^^^ the trait `WrapperTypeDecode` is not implemented for `::Bar` | = note: required for `::Bar` to implement `Decode` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr index f829baeb4c112..f342433149837 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr @@ -18,7 +18,7 @@ error[E0277]: `Bar` doesn't implement `std::fmt::Debug` 40 | pub fn foo(origin: OriginFor, _bar: Bar) -> DispatchResultWithPostInfo { | ^^^^ `Bar` cannot be formatted using `{:?}` | - = help: the trait `std::fmt::Debug` is not implemented for `Bar`, which is required by `&Bar: std::fmt::Debug` + = help: the trait `std::fmt::Debug` is not implemented for `Bar` = note: add `#[derive(Debug)]` to `Bar` or manually `impl std::fmt::Debug for Bar` = note: required for `&Bar` to implement `std::fmt::Debug` = note: required for the cast from `&&Bar` to `&dyn std::fmt::Debug` diff --git a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr index 2fcc332821408..d36a9a453c57c 100644 --- a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr @@ -35,7 +35,7 @@ error[E0277]: the trait bound `Vec: MaxEncodedLen` is not satisfied ... | 35 | | #[pallet::storage] 36 | | type MyStorage = StorageValue<_, Vec>; - | |__________________^ the trait `MaxEncodedLen` is not implemented for `Vec`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageMyStorage, Vec>: StorageInfoTrait` + | |__________________^ the trait `MaxEncodedLen` is not implemented for `Vec` | = help: the following other types implement trait `MaxEncodedLen`: () diff --git a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr index e9c2eae686baf..44660d2690603 100644 --- a/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/event_field_not_member.stderr @@ -16,6 +16,6 @@ error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` 41 | B { b: T::Bar }, | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `::Bar`, which is required by `&::Bar: std::fmt::Debug` + = help: the trait `std::fmt::Debug` is not implemented for `::Bar` = note: required for `&::Bar` to implement `std::fmt::Debug` = note: required for the cast from `&&::Bar` to `&dyn std::fmt::Debug` diff --git a/substrate/frame/support/test/tests/pallet_ui/hooks_invalid_item.stderr b/substrate/frame/support/test/tests/pallet_ui/hooks_invalid_item.stderr index c04499dbbd144..5c37e99fac220 100644 --- a/substrate/frame/support/test/tests/pallet_ui/hooks_invalid_item.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/hooks_invalid_item.stderr @@ -18,4 +18,6 @@ error[E0277]: the trait bound `pallet::Pallet: Hooks<<< tests/pallet_ui/hooks_invalid_item.rs:28:12 | 28 | #[pallet::hooks] - | ^^^^^ the trait `Hooks<<<::Block as frame_support::sp_runtime::traits::Block>::Header as frame_support::sp_runtime::traits::Header>::Number>` is not implemented for `pallet::Pallet` + | ^^^^^ unsatisfied trait bound + | + = help: the trait `Hooks<<<::Block as frame_support::sp_runtime::traits::Block>::Header as frame_support::sp_runtime::traits::Header>::Number>` is not implemented for `pallet::Pallet` diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.stderr index 641cdef1cc087..fee09c8011ba2 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.stderr @@ -9,7 +9,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -31,7 +31,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -58,7 +58,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T @@ -81,7 +81,7 @@ error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `TypeInfo` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `TypeInfo` is not implemented for `Bar` | = help: the following other types implement trait `TypeInfo`: &T @@ -102,7 +102,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -119,7 +119,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -141,7 +141,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T @@ -164,7 +164,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -181,7 +181,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -203,7 +203,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.stderr index a79a3509e69c8..be362137e8e17 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.stderr @@ -9,7 +9,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -31,7 +31,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -58,7 +58,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: PartialStorageInfoTrait` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T @@ -81,7 +81,7 @@ error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `TypeInfo` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `TypeInfo` is not implemented for `Bar` | = help: the following other types implement trait `TypeInfo`: &T @@ -102,7 +102,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -119,7 +119,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -141,7 +141,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageEntryMetadataBuilder` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T @@ -164,7 +164,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `WrapperTypeDecode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeDecode`: Arc @@ -181,7 +181,7 @@ error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `EncodeLike` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `EncodeLike` is not implemented for `Bar` | = help: the following other types implement trait `EncodeLike`: `&&T` implements `EncodeLike` @@ -203,7 +203,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied 38 | #[pallet::storage] | _______________^ 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: TryDecodeEntireStorage` + | |____________^ the trait `WrapperTypeEncode` is not implemented for `Bar` | = help: the following other types implement trait `WrapperTypeEncode`: &T diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied.stderr index 95ec76e29c0be..637f9fc126856 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied.stderr @@ -9,7 +9,7 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied ... | 38 | | #[pallet::storage] 39 | | type Foo = StorageValue<_, Bar>; - | |____________^ the trait `MaxEncodedLen` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo, Bar>: StorageInfoTrait` + | |____________^ the trait `MaxEncodedLen` is not implemented for `Bar` | = help: the following other types implement trait `MaxEncodedLen`: () diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 8351dd92d5944..2c1d7c2fd8ed3 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -9,7 +9,7 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied ... | 41 | | #[pallet::storage] 42 | | type Foo = StorageNMap<_, Key, u32>; - | |____________^ the trait `MaxEncodedLen` is not implemented for `Bar`, which is required by `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>: StorageInfoTrait` + | |____________^ the trait `MaxEncodedLen` is not implemented for `Bar` | = help: the following other types implement trait `MaxEncodedLen`: () @@ -22,4 +22,6 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) and $N others = note: required for `NMapKey` to implement `KeyGeneratorMaxEncodedLen` - = note: required for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` to implement `StorageInfoTrait` + = note: required for `StorageNMap<_GeneratedPrefixForStorageFoo, Key<..., ...>, ...>` to implement `StorageInfoTrait` + = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-442ae00a2d6a9bf5.long-type-8753052295949820456.txt' + = note: consider using `--verbose` to print the full type name to the console diff --git a/substrate/primitives/api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr b/substrate/primitives/api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr index 26be311c02fa4..7383fd4f2b29a 100644 --- a/substrate/primitives/api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr +++ b/substrate/primitives/api/test/tests/ui/type_reference_in_impl_runtime_apis_call.stderr @@ -54,10 +54,6 @@ note: associated function defined here | 27 | fn test(data: u64); | ^^^^ -help: consider removing the borrow - | -33 | fn test(data: &u64) { - | error: unused variable: `data` --> tests/ui/type_reference_in_impl_runtime_apis_call.rs:33:11 diff --git a/substrate/primitives/runtime-interface/tests/ui/no_feature_gated_method.stderr b/substrate/primitives/runtime-interface/tests/ui/no_feature_gated_method.stderr index 1c1649d011e68..35be091749e6b 100644 --- a/substrate/primitives/runtime-interface/tests/ui/no_feature_gated_method.stderr +++ b/substrate/primitives/runtime-interface/tests/ui/no_feature_gated_method.stderr @@ -26,7 +26,7 @@ note: the item is gated here | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `runtime_interface` (in Nightly builds, run with -Z macro-backtrace for more info) -error: unexpected `cfg` condition value: `bar-feature` +warning: unexpected `cfg` condition value: `bar-feature` --> tests/ui/no_feature_gated_method.rs:24:8 | 24 | #[cfg(feature = "bar-feature")] @@ -35,10 +35,9 @@ error: unexpected `cfg` condition value: `bar-feature` = note: expected values for `feature` are: `default`, `disable_target_static_assertions`, and `std` = help: consider adding `bar-feature` as a feature in `Cargo.toml` = note: see for more information about checking conditional configuration - = note: `-D unexpected-cfgs` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]` + = note: `#[warn(unexpected_cfgs)]` on by default -error: unexpected `cfg` condition value: `bar-feature` +warning: unexpected `cfg` condition value: `bar-feature` --> tests/ui/no_feature_gated_method.rs:27:12 | 27 | #[cfg(not(feature = "bar-feature"))] From 52c88dfe665865a10b0036883a76fe33c450859c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Mon, 17 Feb 2025 16:44:12 +0100 Subject: [PATCH 20/32] Propagate feature --- polkadot/runtime/common/Cargo.toml | 1 + polkadot/runtime/parachains/Cargo.toml | 1 + substrate/frame/lottery/Cargo.toml | 1 + substrate/frame/society/Cargo.toml | 1 + substrate/frame/support/test/Cargo.toml | 8 ++++---- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/polkadot/runtime/common/Cargo.toml b/polkadot/runtime/common/Cargo.toml index 4ffa5c475ed77..1ffe04b1ddc01 100644 --- a/polkadot/runtime/common/Cargo.toml +++ b/polkadot/runtime/common/Cargo.toml @@ -121,6 +121,7 @@ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-election-provider-support/runtime-benchmarks", "frame-support/runtime-benchmarks", + "frame-support-test/runtime-benchmarks", "frame-system/runtime-benchmarks", "libsecp256k1/hmac", "libsecp256k1/static-context", diff --git a/polkadot/runtime/parachains/Cargo.toml b/polkadot/runtime/parachains/Cargo.toml index 6c87f7773c235..bac6e9e6a5092 100644 --- a/polkadot/runtime/parachains/Cargo.toml +++ b/polkadot/runtime/parachains/Cargo.toml @@ -121,6 +121,7 @@ std = [ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", + "frame-support-test/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", diff --git a/substrate/frame/lottery/Cargo.toml b/substrate/frame/lottery/Cargo.toml index 23eb19c7ffa7d..9bbf65b13a54f 100644 --- a/substrate/frame/lottery/Cargo.toml +++ b/substrate/frame/lottery/Cargo.toml @@ -47,6 +47,7 @@ std = [ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", + "frame-support-test/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/substrate/frame/society/Cargo.toml b/substrate/frame/society/Cargo.toml index d5860518fdda8..ee4427c38508b 100644 --- a/substrate/frame/society/Cargo.toml +++ b/substrate/frame/society/Cargo.toml @@ -56,6 +56,7 @@ runtime-benchmarks = [ "frame-benchmarking", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", + "frame-support-test/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/substrate/frame/support/test/Cargo.toml b/substrate/frame/support/test/Cargo.toml index bc10ddd6aff0f..37287452f319d 100644 --- a/substrate/frame/support/test/Cargo.toml +++ b/substrate/frame/support/test/Cargo.toml @@ -61,10 +61,10 @@ std = [ ] experimental = ["frame-support/experimental", "frame-system/experimental"] runtime-benchmarks = [ - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", From 959499298a52c4ed475ebb7f03727a8d2566ee7c Mon Sep 17 00:00:00 2001 From: "cmd[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 20:46:56 +0000 Subject: [PATCH 21/32] Update from athei running command 'fmt --clean' --- polkadot/runtime/common/Cargo.toml | 2 +- polkadot/runtime/parachains/Cargo.toml | 2 +- substrate/frame/lottery/Cargo.toml | 2 +- substrate/frame/society/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/polkadot/runtime/common/Cargo.toml b/polkadot/runtime/common/Cargo.toml index 1ffe04b1ddc01..066fd1ef32bfc 100644 --- a/polkadot/runtime/common/Cargo.toml +++ b/polkadot/runtime/common/Cargo.toml @@ -120,8 +120,8 @@ std = [ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-election-provider-support/runtime-benchmarks", - "frame-support/runtime-benchmarks", "frame-support-test/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "libsecp256k1/hmac", "libsecp256k1/static-context", diff --git a/polkadot/runtime/parachains/Cargo.toml b/polkadot/runtime/parachains/Cargo.toml index bac6e9e6a5092..145b533cbb15a 100644 --- a/polkadot/runtime/parachains/Cargo.toml +++ b/polkadot/runtime/parachains/Cargo.toml @@ -120,8 +120,8 @@ std = [ ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", "frame-support-test/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-balances/runtime-benchmarks", diff --git a/substrate/frame/lottery/Cargo.toml b/substrate/frame/lottery/Cargo.toml index 9bbf65b13a54f..f59bd8003e310 100644 --- a/substrate/frame/lottery/Cargo.toml +++ b/substrate/frame/lottery/Cargo.toml @@ -46,8 +46,8 @@ std = [ ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", "frame-support-test/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", diff --git a/substrate/frame/society/Cargo.toml b/substrate/frame/society/Cargo.toml index ee4427c38508b..e507538640f5e 100644 --- a/substrate/frame/society/Cargo.toml +++ b/substrate/frame/society/Cargo.toml @@ -55,8 +55,8 @@ std = [ runtime-benchmarks = [ "frame-benchmarking", "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", "frame-support-test/runtime-benchmarks", + "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", From 353f572cb8b0d05df9c96affa47d3d4f8ecf79c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 10:45:55 +0100 Subject: [PATCH 22/32] Update ui tests --- .../test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 2c1d7c2fd8ed3..c8c7409f571da 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -23,5 +23,5 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied and $N others = note: required for `NMapKey` to implement `KeyGeneratorMaxEncodedLen` = note: required for `StorageNMap<_GeneratedPrefixForStorageFoo, Key<..., ...>, ...>` to implement `StorageInfoTrait` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/aarch64-apple-darwin/debug/deps/$CRATE-442ae00a2d6a9bf5.long-type-8753052295949820456.txt' + = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/x86_64-unknown-linux-gnu/debug/deps/$CRATE-ea9f10b13f03f263.long-type-5041300754977318740.txt' = note: consider using `--verbose` to print the full type name to the console From b027852d89797a2ab2252212e324ff1cafabfdc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 11:26:43 +0100 Subject: [PATCH 23/32] Disable failing ui test --- ...isfied_nmap.rs => storage_info_unsatisfied_nmap.rs.disabled} | 2 ++ 1 file changed, 2 insertions(+) rename substrate/frame/support/test/tests/pallet_ui/{storage_info_unsatisfied_nmap.rs => storage_info_unsatisfied_nmap.rs.disabled} (94%) diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled similarity index 94% rename from substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs rename to substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled index be0665db7b671..9b9163d834a0f 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled @@ -15,6 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! Disabled because the error contains a hash that changes on each build + #[frame_support::pallet] mod pallet { use frame_support::{ From 50acd8753f346ac72b5e91c230e365fde5a02082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 11:29:51 +0100 Subject: [PATCH 24/32] Revert "Disable failing ui test" This reverts commit b027852d89797a2ab2252212e324ff1cafabfdc2. --- ...isfied_nmap.rs.disabled => storage_info_unsatisfied_nmap.rs} | 2 -- 1 file changed, 2 deletions(-) rename substrate/frame/support/test/tests/pallet_ui/{storage_info_unsatisfied_nmap.rs.disabled => storage_info_unsatisfied_nmap.rs} (94%) diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs similarity index 94% rename from substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled rename to substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs index 9b9163d834a0f..be0665db7b671 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs.disabled +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs @@ -15,8 +15,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Disabled because the error contains a hash that changes on each build - #[frame_support::pallet] mod pallet { use frame_support::{ From dc6229d3d799f61a25d25bf679b57d006ee7c660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 11:43:07 +0100 Subject: [PATCH 25/32] Bump trybuild to be compatible with newest Rust --- Cargo.lock | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6fefcfdfe186..76455fdb82945 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1747,15 +1747,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "basic-toml" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db21524cad41c5591204d22d75e1970a2d1f71060214ca931dc7d5afe2c14e5" -dependencies = [ - "serde", -] - [[package]] name = "binary-merkle-tree" version = "13.0.0" @@ -29640,6 +29631,12 @@ version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +[[package]] +name = "target-triple" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a4d50cdb458045afc8131fd91b64904da29548bcb63c7236e0844936c13078" + [[package]] name = "tempfile" version = "3.14.0" @@ -30488,18 +30485,18 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trybuild" -version = "1.0.89" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9d3ba662913483d6722303f619e75ea10b7855b0f8e0d72799cf8621bb488f" +checksum = "b812699e0c4f813b872b373a4471717d9eb550da14b311058a4d9cf4173cbca6" dependencies = [ - "basic-toml", "dissimilar", "glob", - "once_cell", "serde", "serde_derive", "serde_json", + "target-triple", "termcolor", + "toml 0.8.19", ] [[package]] From 3c2bc5bf315365b55b2e213f350e00f8ed3a58bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 18:11:56 +0100 Subject: [PATCH 26/32] Update UI tests --- .../benchmark_ui/dup_attr_pov_mode.stderr | 5 ++-- .../deprecated_where_block.stderr | 17 ++++++------- .../call_argument_invalid_bound.stderr | 18 ++++++------- .../call_argument_invalid_bound_2.stderr | 18 ++++++------- .../call_argument_invalid_bound_3.stderr | 18 ++++++------- .../call_weight_argument_has_suffix.stderr | 13 +++++----- .../call_weight_const_warning_twice.stderr | 23 ++++++++--------- .../call_weight_inherited_invalid3.stderr | 5 ++-- ...ev_mode_without_arg_max_encoded_len.stderr | 25 +++++++++---------- .../storage_info_unsatisfied_nmap.stderr | 4 +-- .../task_condition_invalid_arg.stderr | 5 ++-- .../pallet_ui/task_invalid_condition.stderr | 5 ++-- .../tests/pallet_ui/task_invalid_list.stderr | 5 ++-- .../pallet_ui/task_invalid_weight.stderr | 5 ++-- 14 files changed, 74 insertions(+), 92 deletions(-) diff --git a/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr b/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr index aab91d271a694..03365418ac91a 100644 --- a/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr +++ b/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr @@ -4,11 +4,10 @@ error: unexpected end of input, `pov_mode` can only be specified once 25 | #[benchmark(pov_mode = Measured, pov_mode = MaxEncodedLen)] | ^ -error: unused import: `frame_support_test::Config` +warning: unused import: `frame_support_test::Config` --> tests/benchmark_ui/dup_attr_pov_mode.rs:19:5 | 19 | use frame_support_test::Config; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr index b468b8647ca19..f8144fca2ee06 100644 --- a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr +++ b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr @@ -1,10 +1,10 @@ -error: use of deprecated constant `WhereSection::_w`: - It is deprecated to use a `where` clause in `construct_runtime`. - Please instead use `frame_system::Config` to set the `Block` type and delete this clause. - It is planned to be removed in December 2023. +warning: use of deprecated constant `WhereSection::_w`: + It is deprecated to use a `where` clause in `construct_runtime`. + Please instead use `frame_system::Config` to set the `Block` type and delete this clause. + It is planned to be removed in December 2023. - For more info see: - + For more info see: + --> tests/construct_runtime_ui/deprecated_where_block.rs:20:1 | 20 | / construct_runtime! { @@ -16,9 +16,8 @@ error: use of deprecated constant `WhereSection::_w`: 28 | | } | |_^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` - = note: this error originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `#[warn(deprecated)]` on by default + = note: this warning originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Runtime: Config` is not satisfied --> tests/construct_runtime_ui/deprecated_where_block.rs:20:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr index 883740ea92457..5a7654701f4bf 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr @@ -1,16 +1,15 @@ -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound.rs:36:20 | 36 | #[pallet::weight(0)] | ^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound.rs:38:36 @@ -34,11 +33,10 @@ error[E0369]: binary operation `==` cannot be applied to type `&, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^ -error: unused variable: `origin` +warning: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound.rs:38:14 | 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `-D unused-variables` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_variables)]` + = note: `#[warn(unused_variables)]` on by default diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr index 999f9fea87251..2fef17fd2ad08 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr @@ -1,16 +1,15 @@ -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound_2.rs:36:20 | 36 | #[pallet::weight(0)] | ^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound_2.rs:38:36 @@ -53,11 +52,10 @@ error[E0277]: the trait bound `::Bar: Decode` is not satisf | = note: required for `::Bar` to implement `Decode` -error: unused variable: `origin` +warning: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound_2.rs:38:14 | 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `-D unused-variables` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_variables)]` + = note: `#[warn(unused_variables)]` on by default diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr index f342433149837..0b0b1c87f7785 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr @@ -1,16 +1,15 @@ -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound_3.rs:38:20 | 38 | #[pallet::weight(0)] | ^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default error[E0277]: `Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound_3.rs:40:36 @@ -28,11 +27,10 @@ help: consider annotating `Bar` with `#[derive(Debug)]` 35 | struct Bar; | -error: unused variable: `origin` +warning: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound_3.rs:40:14 | 40 | pub fn foo(origin: OriginFor, _bar: Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `-D unused-variables` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_variables)]` + = note: `#[warn(unused_variables)]` on by default diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr index 4b5abdcd0e6d2..13df196c3df47 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr @@ -6,16 +6,15 @@ error: invalid suffix `something` for number literal | = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_argument_has_suffix.rs:32:26 | 32 | #[pallet::weight(10_000something)] | ^^^^^^^^^^^^^^^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr index d7e4951e49fcf..fba83f3a7b208 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr @@ -6,26 +6,25 @@ error: invalid suffix `custom_prefix` for number literal | = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_const_warning_twice.rs:32:26 | 32 | #[pallet::weight(123)] | ^^^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default -error: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_const_warning_twice.rs:36:26 | 36 | #[pallet::weight(123_custom_prefix)] diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr index 339551d9811c5..f7a6faa05c573 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr @@ -10,11 +10,10 @@ error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier 60 | #[pallet::call(weight = 123)] | ^^^ -error: unused import: `frame_system::pallet_prelude::*` +warning: unused import: `frame_system::pallet_prelude::*` --> tests/pallet_ui/call_weight_inherited_invalid3.rs:21:5 | 21 | use frame_system::pallet_prelude::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default diff --git a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr index d36a9a453c57c..2a16ae146e7d6 100644 --- a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr @@ -1,24 +1,23 @@ -error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`: - It is deprecated to use implicit call indices. - Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`: + It is deprecated to use implicit call indices. + Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode. - For more info see: - - + For more info see: + + --> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:42:10 | 42 | pub fn my_call(_origin: OriginFor) -> DispatchResult { | ^^^^^^^ | - = note: `-D deprecated` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: `#[warn(deprecated)]` on by default -error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:41:20 | 41 | #[pallet::weight(0)] diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index c8c7409f571da..782130bb3b27e 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -22,6 +22,4 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) and $N others = note: required for `NMapKey` to implement `KeyGeneratorMaxEncodedLen` - = note: required for `StorageNMap<_GeneratedPrefixForStorageFoo, Key<..., ...>, ...>` to implement `StorageInfoTrait` - = note: the full name for the type has been written to '$WORKSPACE/target/tests/trybuild/x86_64-unknown-linux-gnu/debug/deps/$CRATE-ea9f10b13f03f263.long-type-5041300754977318740.txt' - = note: consider using `--verbose` to print the full type name to the console + = note: required for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` to implement `StorageInfoTrait` diff --git a/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr b/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr index 9c7bad8119f54..8ba961c65e829 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr @@ -1,11 +1,10 @@ -error: unused import: `frame_system::pallet_prelude::OriginFor` +warning: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_condition_invalid_arg.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default error[E0308]: mismatched types --> tests/pallet_ui/task_condition_invalid_arg.rs:35:10 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr index 05c0ba5eecf26..f6efdaf5b6ae8 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr @@ -1,11 +1,10 @@ -error: unused import: `frame_system::pallet_prelude::OriginFor` +warning: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_condition.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default error[E0308]: mismatched types --> tests/pallet_ui/task_invalid_condition.rs:18:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr index 536d02610cb9f..a64e741872a31 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr @@ -1,11 +1,10 @@ -error: unused import: `frame_system::pallet_prelude::OriginFor` +warning: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_list.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default error[E0689]: can't call method `map` on ambiguous numeric type `{integer}` --> tests/pallet_ui/task_invalid_list.rs:18:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr index 24e925a069920..74acce8b73531 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr @@ -1,11 +1,10 @@ -error: unused import: `frame_system::pallet_prelude::OriginFor` +warning: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_weight.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `-D unused-imports` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unused_imports)]` + = note: `#[warn(unused_imports)]` on by default error[E0308]: mismatched types --> tests/pallet_ui/task_invalid_weight.rs:18:1 From 83b350e7f2f8ffe83f48dffb7976efa7019c7fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 19:56:26 +0100 Subject: [PATCH 27/32] Use `CARGO_ENCODED_RUSTFLAGS` in order to adapt to new trybuild version --- substrate/frame/support/test/tests/benchmark_ui.rs | 2 +- substrate/frame/support/test/tests/construct_runtime_ui.rs | 2 +- substrate/frame/support/test/tests/derive_impl_ui.rs | 2 +- substrate/frame/support/test/tests/derive_no_bound_ui.rs | 3 +++ substrate/frame/support/test/tests/pallet_ui.rs | 2 +- substrate/frame/support/test/tests/runtime_ui.rs | 2 +- substrate/frame/support/test/tests/split_ui.rs | 2 +- substrate/frame/support/test/tests/storage_alias_ui.rs | 3 +++ 8 files changed, 12 insertions(+), 6 deletions(-) diff --git a/substrate/frame/support/test/tests/benchmark_ui.rs b/substrate/frame/support/test/tests/benchmark_ui.rs index aa5fadd0e27bf..410f9e09a43a1 100644 --- a/substrate/frame/support/test/tests/benchmark_ui.rs +++ b/substrate/frame/support/test/tests/benchmark_ui.rs @@ -28,7 +28,7 @@ fn benchmark_ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Pallet's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/benchmark_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/construct_runtime_ui.rs b/substrate/frame/support/test/tests/construct_runtime_ui.rs index 0cf857e2d73c0..3ff60a60c611c 100644 --- a/substrate/frame/support/test/tests/construct_runtime_ui.rs +++ b/substrate/frame/support/test/tests/construct_runtime_ui.rs @@ -28,7 +28,7 @@ fn ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Runtime's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/construct_runtime_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/derive_impl_ui.rs b/substrate/frame/support/test/tests/derive_impl_ui.rs index ee219d0670aaf..84c010187b82e 100644 --- a/substrate/frame/support/test/tests/derive_impl_ui.rs +++ b/substrate/frame/support/test/tests/derive_impl_ui.rs @@ -30,7 +30,7 @@ fn derive_impl_ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Pallet's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/derive_impl_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/derive_no_bound_ui.rs b/substrate/frame/support/test/tests/derive_no_bound_ui.rs index b1c9283c0925a..11f61f6329b3c 100644 --- a/substrate/frame/support/test/tests/derive_no_bound_ui.rs +++ b/substrate/frame/support/test/tests/derive_no_bound_ui.rs @@ -27,6 +27,9 @@ fn derive_no_bound_ui() { // As trybuild is using `cargo check`, we don't need the real WASM binaries. std::env::set_var("SKIP_WASM_BUILD", "1"); + // Deny all warnings since we emit warnings as part of a Pallet's UI. + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); + let t = trybuild::TestCases::new(); t.compile_fail("tests/derive_no_bound_ui/*.rs"); } diff --git a/substrate/frame/support/test/tests/pallet_ui.rs b/substrate/frame/support/test/tests/pallet_ui.rs index 466957c9faa63..c92b07b829d5d 100644 --- a/substrate/frame/support/test/tests/pallet_ui.rs +++ b/substrate/frame/support/test/tests/pallet_ui.rs @@ -28,7 +28,7 @@ fn pallet_ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Pallet's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/pallet_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/runtime_ui.rs b/substrate/frame/support/test/tests/runtime_ui.rs index dbe150f38ed6a..83847f71cfe90 100644 --- a/substrate/frame/support/test/tests/runtime_ui.rs +++ b/substrate/frame/support/test/tests/runtime_ui.rs @@ -28,7 +28,7 @@ fn ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Runtime's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/runtime_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/split_ui.rs b/substrate/frame/support/test/tests/split_ui.rs index 14f99b8ecdab1..50a3f812145fe 100644 --- a/substrate/frame/support/test/tests/split_ui.rs +++ b/substrate/frame/support/test/tests/split_ui.rs @@ -28,7 +28,7 @@ fn split_ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Deny all warnings since we emit warnings as part of a Pallet's UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/split_ui/*.rs"); diff --git a/substrate/frame/support/test/tests/storage_alias_ui.rs b/substrate/frame/support/test/tests/storage_alias_ui.rs index b82acd8f3be43..ab25808e9718a 100644 --- a/substrate/frame/support/test/tests/storage_alias_ui.rs +++ b/substrate/frame/support/test/tests/storage_alias_ui.rs @@ -27,6 +27,9 @@ fn storage_alias_ui() { // As trybuild is using `cargo check`, we don't need the real WASM binaries. std::env::set_var("SKIP_WASM_BUILD", "1"); + // Deny all warnings since we emit warnings as part of a Runtime's UI. + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); + let t = trybuild::TestCases::new(); t.compile_fail("tests/storage_alias_ui/*.rs"); } From 7111fdbc9abbfd87a3f7b44f2a3adc56a4c98d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 22:32:58 +0100 Subject: [PATCH 28/32] Update ui tests --- .../benchmark_ui/dup_attr_pov_mode.stderr | 5 ++-- .../benchmark_ui/pass/valid_const_expr.rs | 1 + .../deprecated_where_block.stderr | 17 +++++++------ .../call_argument_invalid_bound.stderr | 18 +++++++------ .../call_argument_invalid_bound_2.stderr | 18 +++++++------ .../call_argument_invalid_bound_3.stderr | 18 +++++++------ .../tests/pallet_ui/call_missing_index.stderr | 21 ++++++++++++++++ .../call_weight_argument_has_suffix.stderr | 13 +++++----- .../call_weight_const_warning.stderr | 18 +++++++++++++ .../call_weight_const_warning_twice.stderr | 23 +++++++++-------- .../call_weight_inherited_invalid3.stderr | 5 ++-- .../call_weight_unchecked_warning.stderr | 18 +++++++++++++ ...ev_mode_without_arg_max_encoded_len.stderr | 25 ++++++++++--------- .../storage_info_unsatisfied_nmap.stderr | 3 ++- .../task_condition_invalid_arg.stderr | 5 ++-- .../pallet_ui/task_invalid_condition.stderr | 5 ++-- .../tests/pallet_ui/task_invalid_list.stderr | 5 ++-- .../pallet_ui/task_invalid_weight.stderr | 5 ++-- 18 files changed, 149 insertions(+), 74 deletions(-) diff --git a/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr b/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr index 03365418ac91a..aab91d271a694 100644 --- a/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr +++ b/substrate/frame/support/test/tests/benchmark_ui/dup_attr_pov_mode.stderr @@ -4,10 +4,11 @@ error: unexpected end of input, `pov_mode` can only be specified once 25 | #[benchmark(pov_mode = Measured, pov_mode = MaxEncodedLen)] | ^ -warning: unused import: `frame_support_test::Config` +error: unused import: `frame_support_test::Config` --> tests/benchmark_ui/dup_attr_pov_mode.rs:19:5 | 19 | use frame_support_test::Config; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` diff --git a/substrate/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs b/substrate/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs index b1ef44be8b09d..e6ba5873e899d 100644 --- a/substrate/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs +++ b/substrate/frame/support/test/tests/benchmark_ui/pass/valid_const_expr.rs @@ -25,6 +25,7 @@ mod benches { const MY_CONST: u32 = 100; + #[allow(dead_code)] const fn my_fn() -> u32 { 200 } diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr index f8144fca2ee06..b468b8647ca19 100644 --- a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr +++ b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr @@ -1,10 +1,10 @@ -warning: use of deprecated constant `WhereSection::_w`: - It is deprecated to use a `where` clause in `construct_runtime`. - Please instead use `frame_system::Config` to set the `Block` type and delete this clause. - It is planned to be removed in December 2023. +error: use of deprecated constant `WhereSection::_w`: + It is deprecated to use a `where` clause in `construct_runtime`. + Please instead use `frame_system::Config` to set the `Block` type and delete this clause. + It is planned to be removed in December 2023. - For more info see: - + For more info see: + --> tests/construct_runtime_ui/deprecated_where_block.rs:20:1 | 20 | / construct_runtime! { @@ -16,8 +16,9 @@ warning: use of deprecated constant `WhereSection::_w`: 28 | | } | |_^ | - = note: `#[warn(deprecated)]` on by default - = note: this warning originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` + = note: this error originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Runtime: Config` is not satisfied --> tests/construct_runtime_ui/deprecated_where_block.rs:20:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr index 5a7654701f4bf..883740ea92457 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr @@ -1,15 +1,16 @@ -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound.rs:36:20 | 36 | #[pallet::weight(0)] | ^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound.rs:38:36 @@ -33,10 +34,11 @@ error[E0369]: binary operation `==` cannot be applied to type `&, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^ -warning: unused variable: `origin` +error: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound.rs:38:14 | 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `#[warn(unused_variables)]` on by default + = note: `-D unused-variables` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_variables)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr index 2fef17fd2ad08..999f9fea87251 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr @@ -1,15 +1,16 @@ -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound_2.rs:36:20 | 36 | #[pallet::weight(0)] | ^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound_2.rs:38:36 @@ -52,10 +53,11 @@ error[E0277]: the trait bound `::Bar: Decode` is not satisf | = note: required for `::Bar` to implement `Decode` -warning: unused variable: `origin` +error: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound_2.rs:38:14 | 38 | pub fn foo(origin: OriginFor, _bar: T::Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `#[warn(unused_variables)]` on by default + = note: `-D unused-variables` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_variables)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr index 0b0b1c87f7785..f342433149837 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr @@ -1,15 +1,16 @@ -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_argument_invalid_bound_3.rs:38:20 | 38 | #[pallet::weight(0)] | ^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` error[E0277]: `Bar` doesn't implement `std::fmt::Debug` --> tests/pallet_ui/call_argument_invalid_bound_3.rs:40:36 @@ -27,10 +28,11 @@ help: consider annotating `Bar` with `#[derive(Debug)]` 35 | struct Bar; | -warning: unused variable: `origin` +error: unused variable: `origin` --> tests/pallet_ui/call_argument_invalid_bound_3.rs:40:14 | 40 | pub fn foo(origin: OriginFor, _bar: Bar) -> DispatchResultWithPostInfo { | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_origin` | - = note: `#[warn(unused_variables)]` on by default + = note: `-D unused-variables` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_variables)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_missing_index.stderr b/substrate/frame/support/test/tests/pallet_ui/call_missing_index.stderr index ba06285bdeeab..cace73a333c5a 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_missing_index.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_missing_index.stderr @@ -46,3 +46,24 @@ error: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`: | 36 | #[pallet::weight(0)] | ^ + +error: associated function `error_metadata` is never used + --> tests/pallet_ui/call_missing_index.rs:26:12 + | +26 | #[pallet::pallet] + | ^^^^^^ associated function in this implementation + | + = note: `-D dead-code` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(dead_code)]` + +error: associated functions `new_call_variant_foo` and `new_call_variant_bar` are never used + --> tests/pallet_ui/call_missing_index.rs:32:10 + | +29 | #[pallet::call] + | ---- associated functions in this implementation +... +32 | pub fn foo(_: OriginFor) -> DispatchResult { + | ^^^ +... +37 | pub fn bar(_: OriginFor) -> DispatchResult { + | ^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr index 13df196c3df47..4b5abdcd0e6d2 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_argument_has_suffix.stderr @@ -6,15 +6,16 @@ error: invalid suffix `something` for number literal | = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_argument_has_suffix.rs:32:26 | 32 | #[pallet::weight(10_000something)] | ^^^^^^^^^^^^^^^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning.stderr index d399df4d85bd4..553ae08cefdd1 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning.stderr @@ -11,3 +11,21 @@ error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: | = note: `-D deprecated` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(deprecated)]` + +error: associated function `error_metadata` is never used + --> tests/pallet_ui/call_weight_const_warning.rs:26:12 + | +26 | #[pallet::pallet] + | ^^^^^^ associated function in this implementation + | + = note: `-D dead-code` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(dead_code)]` + +error: associated function `new_call_variant_foo` is never used + --> tests/pallet_ui/call_weight_const_warning.rs:33:10 + | +29 | #[pallet::call] + | ---- associated function in this implementation +... +33 | pub fn foo(_: OriginFor) -> DispatchResult { Ok(()) } + | ^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr index fba83f3a7b208..d7e4951e49fcf 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_const_warning_twice.stderr @@ -6,25 +6,26 @@ error: invalid suffix `custom_prefix` for number literal | = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_const_warning_twice.rs:32:26 | 32 | #[pallet::weight(123)] | ^^^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` -warning: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/call_weight_const_warning_twice.rs:36:26 | 36 | #[pallet::weight(123_custom_prefix)] diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr index f7a6faa05c573..339551d9811c5 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_inherited_invalid3.stderr @@ -10,10 +10,11 @@ error: expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier 60 | #[pallet::call(weight = 123)] | ^^^ -warning: unused import: `frame_system::pallet_prelude::*` +error: unused import: `frame_system::pallet_prelude::*` --> tests/pallet_ui/call_weight_inherited_invalid3.rs:21:5 | 21 | use frame_system::pallet_prelude::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` diff --git a/substrate/frame/support/test/tests/pallet_ui/call_weight_unchecked_warning.stderr b/substrate/frame/support/test/tests/pallet_ui/call_weight_unchecked_warning.stderr index 33302a2a0278a..fca5f657c67b7 100644 --- a/substrate/frame/support/test/tests/pallet_ui/call_weight_unchecked_warning.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/call_weight_unchecked_warning.stderr @@ -11,3 +11,21 @@ error: use of deprecated constant `pallet::warnings::UncheckedWeightWitness_0::_ | = note: `-D deprecated` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(deprecated)]` + +error: associated function `error_metadata` is never used + --> tests/pallet_ui/call_weight_unchecked_warning.rs:26:12 + | +26 | #[pallet::pallet] + | ^^^^^^ associated function in this implementation + | + = note: `-D dead-code` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(dead_code)]` + +error: associated function `new_call_variant_foo` is never used + --> tests/pallet_ui/call_weight_unchecked_warning.rs:33:10 + | +29 | #[pallet::call] + | ---- associated function in this implementation +... +33 | pub fn foo(_: OriginFor, _unused: u64) -> DispatchResult { Ok(()) } + | ^^^ diff --git a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr index 2a16ae146e7d6..d36a9a453c57c 100644 --- a/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr @@ -1,23 +1,24 @@ -warning: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`: - It is deprecated to use implicit call indices. - Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`: + It is deprecated to use implicit call indices. + Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode. - For more info see: - - + For more info see: + + --> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:42:10 | 42 | pub fn my_call(_origin: OriginFor) -> DispatchResult { | ^^^^^^^ | - = note: `#[warn(deprecated)]` on by default + = note: `-D deprecated` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(deprecated)]` -warning: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: - It is deprecated to use hard-coded constant as call weight. - Please instead benchmark all calls or put the pallet into `dev` mode. +error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`: + It is deprecated to use hard-coded constant as call weight. + Please instead benchmark all calls or put the pallet into `dev` mode. - For more info see: - + For more info see: + --> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:41:20 | 41 | #[pallet::weight(0)] diff --git a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 782130bb3b27e..a601c9f33f665 100644 --- a/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -22,4 +22,5 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) and $N others = note: required for `NMapKey` to implement `KeyGeneratorMaxEncodedLen` - = note: required for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` to implement `StorageInfoTrait` + = note: required for `StorageNMap<_GeneratedPrefixForStorageFoo, Key<..., ...>, ...>` to implement `StorageInfoTrait` + = note: consider using `--verbose` to print the full type name to the console diff --git a/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr b/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr index 8ba961c65e829..9c7bad8119f54 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_condition_invalid_arg.stderr @@ -1,10 +1,11 @@ -warning: unused import: `frame_system::pallet_prelude::OriginFor` +error: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_condition_invalid_arg.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` error[E0308]: mismatched types --> tests/pallet_ui/task_condition_invalid_arg.rs:35:10 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr index f6efdaf5b6ae8..05c0ba5eecf26 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_condition.stderr @@ -1,10 +1,11 @@ -warning: unused import: `frame_system::pallet_prelude::OriginFor` +error: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_condition.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` error[E0308]: mismatched types --> tests/pallet_ui/task_invalid_condition.rs:18:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr index a64e741872a31..536d02610cb9f 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_list.stderr @@ -1,10 +1,11 @@ -warning: unused import: `frame_system::pallet_prelude::OriginFor` +error: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_list.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` error[E0689]: can't call method `map` on ambiguous numeric type `{integer}` --> tests/pallet_ui/task_invalid_list.rs:18:1 diff --git a/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr b/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr index 74acce8b73531..24e925a069920 100644 --- a/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr +++ b/substrate/frame/support/test/tests/pallet_ui/task_invalid_weight.stderr @@ -1,10 +1,11 @@ -warning: unused import: `frame_system::pallet_prelude::OriginFor` +error: unused import: `frame_system::pallet_prelude::OriginFor` --> tests/pallet_ui/task_invalid_weight.rs:21:6 | 21 | use frame_system::pallet_prelude::OriginFor; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unused_imports)]` on by default + = note: `-D unused-imports` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unused_imports)]` error[E0308]: mismatched types --> tests/pallet_ui/task_invalid_weight.rs:18:1 From c77b47d052db2cd005eb0759eea2bbca53fa6a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 18 Feb 2025 23:45:27 +0100 Subject: [PATCH 29/32] Switch to CARGO_ENCODED_RUSTFLAGS --- substrate/primitives/api/test/tests/trybuild.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/primitives/api/test/tests/trybuild.rs b/substrate/primitives/api/test/tests/trybuild.rs index b13e5df9d6f85..da6a339578e16 100644 --- a/substrate/primitives/api/test/tests/trybuild.rs +++ b/substrate/primitives/api/test/tests/trybuild.rs @@ -28,7 +28,7 @@ fn ui() { std::env::set_var("SKIP_WASM_BUILD", "1"); // Warnings are part of our UI. - std::env::set_var("RUSTFLAGS", "--deny warnings"); + std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "--deny=warnings"); let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/*.rs"); From 1112f820e6dbaeaf5bb2ba769ea61e873d7a98c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 19 Feb 2025 00:05:23 +0100 Subject: [PATCH 30/32] Eliminate dead_code warning --- .../test/tests/pallet_ui/pass/config_multiple_attr.rs | 2 +- .../test/tests/pallet_ui/pass/config_without_metadata.rs | 2 +- .../support/test/tests/pallet_ui/pass/default_config.rs | 2 +- .../test/tests/pallet_ui/pass/error_nested_types.rs | 2 +- .../pass/event_type_bound_system_config_assoc_type.rs | 2 +- .../support/test/tests/pallet_ui/pass/feeless_call.rs | 2 +- .../test/tests/pallet_ui/pass/inherited_call_weight.rs | 4 ++-- .../test/tests/pallet_ui/pass/inherited_call_weight2.rs | 4 ++-- .../test/tests/pallet_ui/pass/inherited_call_weight3.rs | 8 ++++---- .../pallet_ui/pass/inherited_call_weight_dev_mode.rs | 2 +- .../support/test/tests/pallet_ui/pass/simple_storage.rs | 2 +- .../frame/support/test/tests/pallet_ui/pass/task_valid.rs | 4 ++-- .../tests/pallet_ui/pass/trait_constant_valid_bounds.rs | 2 +- .../test/tests/pallet_ui/pass/view_function_valid.rs | 2 +- .../tests/pallet_ui/pass/where_clause_missing_hooks.rs | 4 ++-- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/config_multiple_attr.rs b/substrate/frame/support/test/tests/pallet_ui/pass/config_multiple_attr.rs index c016c52181cf9..e7af18be00e08 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/config_multiple_attr.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/config_multiple_attr.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; #[pallet::config(with_default, without_automatic_metadata)] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/config_without_metadata.rs b/substrate/frame/support/test/tests/pallet_ui/pass/config_without_metadata.rs index c9f5244d73452..734c31431efb8 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/config_without_metadata.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/config_without_metadata.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; #[pallet::config(without_automatic_metadata)] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/default_config.rs b/substrate/frame/support/test/tests/pallet_ui/pass/default_config.rs index f169ee34c9ab5..0d1e92e4be986 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/default_config.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/default_config.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; #[pallet::config(with_default)] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs b/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs index 0e0dc5890519f..b4c18920f7b54 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/error_nested_types.rs @@ -20,7 +20,7 @@ use frame_support::PalletError; #[frame_support::pallet] #[allow(unused_imports)] -mod pallet { +pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config {} diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs b/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs index d84d320b0b24a..f028dd20de869 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/event_type_bound_system_config_assoc_type.rs @@ -17,7 +17,7 @@ #[frame_support::pallet] #[allow(unused_imports)] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::{Hooks, IsType}; use frame_system::pallet_prelude::BlockNumberFor; diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/feeless_call.rs b/substrate/frame/support/test/tests/pallet_ui/pass/feeless_call.rs index 566b7c65cc710..9028d46c9ef9b 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/feeless_call.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/feeless_call.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet(dev_mode)] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::DispatchResult; use frame_system::pallet_prelude::OriginFor; diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs index fdb9d8c401d1d..d37a6da12bd1f 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight.rs @@ -23,7 +23,7 @@ pub trait WeightInfo { } #[frame_support::pallet] -mod parentheses { +pub mod parentheses { use super::*; #[pallet::config] @@ -44,7 +44,7 @@ mod parentheses { } #[frame_support::pallet] -mod assign { +pub mod assign { use super::*; #[pallet::config] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs index 208c719cdfc81..8a569bc96e2fe 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight2.rs @@ -29,7 +29,7 @@ impl WeightInfo for () { } #[frame_support::pallet] -mod parentheses { +pub mod parentheses { use super::*; #[pallet::config] @@ -50,7 +50,7 @@ mod parentheses { } #[frame_support::pallet] -mod assign { +pub mod assign { use super::*; #[pallet::config] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs index ddccd0b3e192c..574b7cceb43f7 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight3.rs @@ -19,16 +19,16 @@ use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; // If, for whatever reason, you don't to not use a `WeightInfo` trait - it will still work. -struct Impl; +pub struct Impl; impl Impl { - fn foo() -> Weight { + pub fn foo() -> Weight { Weight::zero() } } #[frame_support::pallet] -mod parentheses { +pub mod parentheses { use super::*; #[pallet::config] @@ -48,7 +48,7 @@ mod parentheses { } #[frame_support::pallet] -mod assign { +pub mod assign { use super::*; #[pallet::config] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs index a78c9d8f36ebf..6512a3c684815 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/inherited_call_weight_dev_mode.rs @@ -23,7 +23,7 @@ pub trait WeightInfo { } #[frame_support::pallet(dev_mode)] -mod pallet { +pub mod pallet { use super::*; #[pallet::config] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/simple_storage.rs b/substrate/frame/support/test/tests/pallet_ui/pass/simple_storage.rs index 13ed3b2306fa0..00f26e64b1c72 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/simple_storage.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/simple_storage.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; #[pallet::config(with_default)] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/task_valid.rs b/substrate/frame/support/test/tests/pallet_ui/pass/task_valid.rs index bc66c09de7e80..4cc2cfe700bea 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/task_valid.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/task_valid.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet(dev_mode)] -mod pallet { +pub mod pallet { use frame_support::{ensure, pallet_prelude::DispatchResult}; #[pallet::config] @@ -40,7 +40,7 @@ mod pallet { } #[frame_support::pallet(dev_mode)] -mod pallet_with_instance { +pub mod pallet_with_instance { use frame_support::pallet_prelude::{ValueQuery, StorageValue}; #[pallet::config] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/trait_constant_valid_bounds.rs b/substrate/frame/support/test/tests/pallet_ui/pass/trait_constant_valid_bounds.rs index 83b323e3abafd..9fbce7fcafc0c 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/trait_constant_valid_bounds.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/trait_constant_valid_bounds.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::BlockNumberFor; diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/view_function_valid.rs b/substrate/frame/support/test/tests/pallet_ui/pass/view_function_valid.rs index a4c3a6eb9baf5..18392d4c316a5 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/view_function_valid.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/view_function_valid.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { use frame_support::pallet_prelude::*; #[pallet::config(with_default)] diff --git a/substrate/frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs b/substrate/frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs index 560ebbb868708..688fcef3c93fa 100644 --- a/substrate/frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs +++ b/substrate/frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs @@ -16,7 +16,7 @@ // limitations under the License. #[frame_support::pallet] -mod pallet { +pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config where @@ -34,7 +34,7 @@ mod pallet { where ::Nonce: From, { - fn foo(x: u128) { + pub fn foo(x: u128) { let _index = ::Nonce::from(x); } } From 5c1cda5670453ad6cd9d05c8a35b9c226a42217f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 19 Feb 2025 00:06:48 +0100 Subject: [PATCH 31/32] Update trybuild in cargo toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0769a95932d44..cdca5de448443 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1369,7 +1369,7 @@ trie-bench = { version = "0.39.0" } trie-db = { version = "0.29.1", default-features = false } trie-root = { version = "0.18.0", default-features = false } trie-standardmap = { version = "0.16.0" } -trybuild = { version = "1.0.89" } +trybuild = { version = "1.0.103" } tt-call = { version = "1.0.8" } tuplex = { version = "0.1", default-features = false } twox-hash = { version = "1.6.3", default-features = false } From cee6c17191f20a3764f68624489cda1295fafbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 19 Feb 2025 12:47:30 +0100 Subject: [PATCH 32/32] Trigger CI