mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 08:18:04 +00:00
pallet nis: remove benchmarking hack (#13759)
* pallet nis: remove benchmark hack Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * NearestPrefDown -> Down Tested on the kitchensink and in case that n = 10000000000000000 and d = 12000100600000000000000 it rounds the Perquintill up (correctly) since 833326347280+47318160/60000503 should round up. That triggers the path 'amount <= on_hold' in L736. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
29ea9e0ad9
commit
2c0993d0c0
@@ -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());
|
||||
@@ -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());
|
||||
|
||||
@@ -1139,9 +1139,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);
|
||||
|
||||
Reference in New Issue
Block a user