Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Investigate flaky UI test case in storage_info_unsatisfied_nmap.rs #9120

Closed
KiChjang opened this issue Jun 16, 2021 · 1 comment · Fixed by #9122
Closed

Investigate flaky UI test case in storage_info_unsatisfied_nmap.rs #9120

KiChjang opened this issue Jun 16, 2021 · 1 comment · Fixed by #9122
Labels
I5-tests Tests need fixing, improving or augmenting.

Comments

@KiChjang
Copy link
Contributor

KiChjang commented Jun 16, 2021

This UI test:

#[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::pallet]
	#[pallet::generate_storage_info]
	pub struct Pallet<T>(core::marker::PhantomData<T>);

	#[pallet::hooks]
	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}

	#[pallet::call]
	impl<T: Config> Pallet<T> {}

	#[derive(codec::Encode, codec::Decode)]
	struct Bar;

	#[pallet::storage]
	type Foo<T> = StorageNMap<_, NMapKey<Twox64Concat, Bar>, u32>;
}

fn main() {
}

should yield the following error message:

error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
  --> $DIR/storage_info_unsatisfied_nmap.rs:10:12
   |
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 `Key<frame_support::Twox64Concat, Bar>`
   = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`
   = note: required by `storage_info`

However, the Key<Twox64Concat, Bar> syntax in the error message flip-flops between said form and NMapKey<Twox64Concat, Bar>. Further observations reveal that the test case was run twice, once with the --workspace parameter to cargo and the other without, suggesting that it may be related to cargo workspace issues. Other possible causes pin caching as the issue, however more investigation needs to be conducted to determine the root cause of the apparent non-determinism.

The aforementioned test case has been disabled by commenting out the test code in #8949 in order to not block the PR from landing.

@KiChjang KiChjang added the I5-tests Tests need fixing, improving or augmenting. label Jun 16, 2021
@KiChjang
Copy link
Contributor Author

cc @paritytech/ci

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I5-tests Tests need fixing, improving or augmenting.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant