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

pallet nis: remove benchmarking hack #13759

Merged
merged 3 commits into from
Apr 11, 2023
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
6 changes: 0 additions & 6 deletions frame/nis/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ benchmarks! {
Nis::<T>::place_bid(RawOrigin::Signed(caller.clone()).into(), bid, 1)?;
Nis::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
frame_system::Pallet::<T>::set_block_number(Receipts::<T>::get(0).unwrap().expiry);
// FIXME: Ensure that the pallet has enough funding. This should already be the case, but
// a rounding error can cause it to fail.
T::Currency::set_balance(&Nis::<T>::account_id(), BalanceOf::<T>::max_value() / 10u32.into());
}: _(RawOrigin::Signed(caller.clone()), 0, None)
verify {
assert!(Receipts::<T>::get(0).is_none());
Expand All @@ -185,9 +182,6 @@ benchmarks! {
Nis::<T>::process_queues(Perquintill::one(), 1, 2, &mut WeightCounter::unlimited());
frame_system::Pallet::<T>::set_block_number(Receipts::<T>::get(0).unwrap().expiry);
Nis::<T>::communify(RawOrigin::Signed(caller.clone()).into(), 0)?;
// FIXME: Ensure that the pallet has enough funding. This should already be the case, but
// a rounding error can cause it to fail.
T::Currency::set_balance(&Nis::<T>::account_id(), BalanceOf::<T>::max_value() / 10u32.into());
}: _(RawOrigin::Signed(caller.clone()), 0)
verify {
assert!(Receipts::<T>::get(0).is_none());
Expand Down
5 changes: 2 additions & 3 deletions frame/nis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,8 @@ pub mod pallet {
// Now to activate the bid...
let n = amount;
let d = issuance.effective;
let proportion =
Perquintill::from_rational_with_rounding(n, d, Rounding::NearestPrefDown)
.defensive_unwrap_or_default();
let proportion = Perquintill::from_rational_with_rounding(n, d, Rounding::Down)
.defensive_unwrap_or_default();
let who = bid.who;
let index = summary.index;
summary.proportion_owed.defensive_saturating_accrue(proportion);
Expand Down