Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pallet-membership: Do not verify the MembershipChanged in bechmarks #6439

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions prdoc/pr_6439.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: 'pallet-membership: Do not verify the `MembershipChanged` in bechmarks'
doc:
- audience: Runtime Dev
description: |-
There is no need to verify in the `pallet-membership` benchmark that the `MemembershipChanged` implementation works as the pallet thinks it should work. If you for example set it to `()`, `get_prime()` will always return `None`.

TLDR: Remove the checks of `MembershipChanged` in the benchmarks to support any kind of implementation.
crates:
- name: pallet-membership
bump: patch
5 changes: 2 additions & 3 deletions substrate/frame/membership/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ benchmarks_instance_pallet! {
assert!(!Members::<T, I>::get().contains(&remove));
assert!(Members::<T, I>::get().contains(&add));
// prime is rejigged
assert!(Prime::<T, I>::get().is_some() && T::MembershipChanged::get_prime().is_some());
assert!(Prime::<T, I>::get().is_some());
#[cfg(test)] crate::mock::clean();
}

Expand All @@ -119,7 +119,7 @@ benchmarks_instance_pallet! {
new_members.sort();
assert_eq!(Members::<T, I>::get(), new_members);
// prime is rejigged
assert!(Prime::<T, I>::get().is_some() && T::MembershipChanged::get_prime().is_some());
assert!(Prime::<T, I>::get().is_some());
#[cfg(test)] crate::mock::clean();
}

Expand Down Expand Up @@ -157,7 +157,6 @@ benchmarks_instance_pallet! {
));
} verify {
assert!(Prime::<T, I>::get().is_some());
assert!(<T::MembershipChanged>::get_prime().is_some());
#[cfg(test)] crate::mock::clean();
}

Expand Down
Loading