From ea227dbd6f8c4e622e669828e7a49e40b088203d Mon Sep 17 00:00:00 2001 From: thiolliere Date: Wed, 16 Jun 2021 09:35:16 +0200 Subject: [PATCH 1/2] do not run pallet_ui test with conditional-compilation feature --- frame/support/test/tests/pallet_ui.rs | 1 + .../storage_info_unsatisfied_nmap.rs | 37 +++++++++---------- .../storage_info_unsatisfied_nmap.stderr | 12 ++++-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/frame/support/test/tests/pallet_ui.rs b/frame/support/test/tests/pallet_ui.rs index e5f4a54dfb000..9335535849795 100644 --- a/frame/support/test/tests/pallet_ui.rs +++ b/frame/support/test/tests/pallet_ui.rs @@ -16,6 +16,7 @@ // limitations under the License. #[rustversion::attr(not(stable), ignore)] +#[cfg(not(feature = "conditional-compilation"))] #[test] fn pallet_ui() { // As trybuild is using `cargo check`, we don't need the real WASM binaries. diff --git a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs index ef31af92e5a37..3d03099c3c4b6 100644 --- a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs +++ b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.rs @@ -1,28 +1,27 @@ -// #[frame_support::pallet] -// mod pallet { -// use frame_support::pallet_prelude::{Hooks, StorageNMap, Twox64Concat, NMapKey}; -// use frame_system::pallet_prelude::BlockNumberFor; +#[frame_support::pallet] +mod pallet { + use frame_support::pallet_prelude::{Hooks, StorageNMap, Twox64Concat, NMapKey}; + use frame_system::pallet_prelude::BlockNumberFor; -// #[pallet::config] -// pub trait Config: frame_system::Config {} + #[pallet::config] + pub trait Config: frame_system::Config {} -// #[pallet::pallet] -// #[pallet::generate_storage_info] -// pub struct Pallet(core::marker::PhantomData); + #[pallet::pallet] + #[pallet::generate_storage_info] + pub struct Pallet(core::marker::PhantomData); -// #[pallet::hooks] -// impl Hooks> for Pallet {} + #[pallet::hooks] + impl Hooks> for Pallet {} -// #[pallet::call] -// impl Pallet {} + #[pallet::call] + impl Pallet {} -// #[derive(codec::Encode, codec::Decode)] -// struct Bar; + #[derive(codec::Encode, codec::Decode)] + struct Bar; -// #[pallet::storage] -// type Foo = StorageNMap<_, NMapKey, u32>; -// } + #[pallet::storage] + type Foo = StorageNMap<_, NMapKey, u32>; +} fn main() { - compile_error!("Temporarily disabled due to test flakiness"); } diff --git a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 9c69a3f076e34..545520124bfee 100644 --- a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -1,5 +1,9 @@ -error: Temporarily disabled due to test flakiness - --> $DIR/storage_info_unsatisfied_nmap.rs:27:2 +error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied + --> $DIR/storage_info_unsatisfied_nmap.rs:10:12 | -27 | compile_error!("Temporarily disabled due to test flakiness"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +10 | #[pallet::generate_storage_info] + | ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar` + | + = note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `NMapKey` + = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` + = note: required by `storage_info` From 095a42847f5f21541d25fa887db6234f1b8de01a Mon Sep 17 00:00:00 2001 From: thiolliere Date: Wed, 16 Jun 2021 10:35:13 +0200 Subject: [PATCH 2/2] fix --- frame/support/test/tests/pallet_ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/support/test/tests/pallet_ui.rs b/frame/support/test/tests/pallet_ui.rs index 9335535849795..fea7a2c7e7ad4 100644 --- a/frame/support/test/tests/pallet_ui.rs +++ b/frame/support/test/tests/pallet_ui.rs @@ -16,7 +16,7 @@ // limitations under the License. #[rustversion::attr(not(stable), ignore)] -#[cfg(not(feature = "conditional-compilation"))] +#[cfg(not(feature = "conditional-storage"))] #[test] fn pallet_ui() { // As trybuild is using `cargo check`, we don't need the real WASM binaries.