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

Commit 369365e

Browse files
ggwpezAnk4n
authored andcommitted
benchmarks: EnsureRankedMember must add ranked members (#13297)
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
1 parent 4d02469 commit 369365e

File tree

1 file changed

+5
-5
lines changed
  • frame/ranked-collective/src

1 file changed

+5
-5
lines changed

frame/ranked-collective/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ impl<T: Config<I>, I: 'static, const MIN_RANK: u16> EnsureOrigin<T::RuntimeOrigi
256256

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

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

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

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

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

0 commit comments

Comments
 (0)