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

Commit

Permalink
benchmarks: EnsureRankedMember must add ranked members (#13297) (#13348)
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
muharem and ggwpez authored Feb 13, 2023
1 parent 15e218a commit 18bb7c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frame/ranked-collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigi

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
Ok(frame_system::RawOrigin::Signed(who).into())
EnsureRankedMember::<T, I, MIN_RANK>::try_successful_origin()
}
}

Expand All @@ -279,8 +278,7 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigi

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
Ok(frame_system::RawOrigin::Signed(who).into())
EnsureRankedMember::<T, I, MIN_RANK>::try_successful_origin()
}
}

Expand All @@ -302,7 +300,9 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigi

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<T::RuntimeOrigin, ()> {
let who = IndexToId::<T, I>::get(MIN_RANK, 0).ok_or(())?;
let who = frame_benchmarking::account::<T::AccountId>("successful_origin", 0, 0);
crate::Pallet::<T, I>::do_add_member_to_rank(who.clone(), MIN_RANK)
.expect("Could not add members for benchmarks");
Ok(frame_system::RawOrigin::Signed(who).into())
}
}
Expand Down

0 comments on commit 18bb7c7

Please sign in to comment.