Change a few fee/weight parameters (#2481)

* Change a few fee parameters

* Update runtime/common/src/lib.rs
This commit is contained in:
Kian Paimani
2021-02-23 13:34:29 +00:00
committed by GitHub
parent ece23588d2
commit 571651e326
5 changed files with 104 additions and 39 deletions
+17 -33
View File
@@ -1377,39 +1377,23 @@ mod test_fees {
let len = call.using_encoded(|e| e.len()) as u32;
let mut ext = sp_io::TestExternalities::new_empty();
ext.execute_with(|| {
pallet_transaction_payment::NextFeeMultiplier::put(min_multiplier);
let fee = TransactionPayment::compute_fee(len, &info, 0);
println!(
"weight = {:?} // multiplier = {:?} // full transfer fee = {:?}",
info.weight.separated_string(),
pallet_transaction_payment::NextFeeMultiplier::get(),
fee.separated_string(),
);
});
let mut test_with_multiplier = |m| {
ext.execute_with(|| {
pallet_transaction_payment::NextFeeMultiplier::put(m);
let fee = TransactionPayment::compute_fee(len, &info, 0);
println!(
"weight = {:?} // multiplier = {:?} // full transfer fee = {:?}",
info.weight.separated_string(),
pallet_transaction_payment::NextFeeMultiplier::get(),
fee.separated_string(),
);
});
};
ext.execute_with(|| {
let mul = Multiplier::saturating_from_rational(1, 1000_000_000u128);
pallet_transaction_payment::NextFeeMultiplier::put(mul);
let fee = TransactionPayment::compute_fee(len, &info, 0);
println!(
"weight = {:?} // multiplier = {:?} // full transfer fee = {:?}",
info.weight.separated_string(),
pallet_transaction_payment::NextFeeMultiplier::get(),
fee.separated_string(),
);
});
ext.execute_with(|| {
let mul = Multiplier::saturating_from_rational(1, 1u128);
pallet_transaction_payment::NextFeeMultiplier::put(mul);
let fee = TransactionPayment::compute_fee(len, &info, 0);
println!(
"weight = {:?} // multiplier = {:?} // full transfer fee = {:?}",
info.weight.separated_string(),
pallet_transaction_payment::NextFeeMultiplier::get(),
fee.separated_string(),
);
});
test_with_multiplier(min_multiplier);
test_with_multiplier(Multiplier::saturating_from_rational(1, 1u128));
test_with_multiplier(Multiplier::saturating_from_rational(1, 1_000u128));
test_with_multiplier(Multiplier::saturating_from_rational(1, 1_000_000u128));
test_with_multiplier(Multiplier::saturating_from_rational(1, 1_000_000_000u128));
}
}