Introduce WeightToFee trait instead of WeightToFeePolynomial and make WeightToFeePolynomial implement it instead (#11415)

* Introduce `WeightToFee` trait instead of `WeightToFeePolynomial` and make `WeightToFeePolynomial` implement it instead

* Rename `WeightToFee::calc()` to `WeightToFee::wight_to_fee()`

* Fix typo
This commit is contained in:
Nazar Mokrynskyi
2022-05-25 08:32:11 +03:00
committed by GitHub
parent 29474f9893
commit 0c25a2ee40
9 changed files with 86 additions and 112 deletions
+3 -5
View File
@@ -18,9 +18,7 @@
use codec::{Encode, Joiner};
use frame_support::{
traits::Currency,
weights::{
constants::ExtrinsicBaseWeight, GetDispatchInfo, IdentityFee, WeightToFeePolynomial,
},
weights::{constants::ExtrinsicBaseWeight, GetDispatchInfo, IdentityFee, WeightToFee},
};
use node_primitives::Balance;
use node_runtime::{
@@ -197,13 +195,13 @@ fn transaction_fee_is_correct() {
let mut balance_alice = (100 - 69) * DOLLARS;
let base_weight = ExtrinsicBaseWeight::get();
let base_fee = IdentityFee::<Balance>::calc(&base_weight);
let base_fee = IdentityFee::<Balance>::weight_to_fee(&base_weight);
let length_fee = TransactionByteFee::get() * (xt.clone().encode().len() as Balance);
balance_alice -= length_fee;
let weight = default_transfer_call().get_dispatch_info().weight;
let weight_fee = IdentityFee::<Balance>::calc(&weight);
let weight_fee = IdentityFee::<Balance>::weight_to_fee(&weight);
// we know that weight to fee multiplier is effect-less in block 1.
// current weight of transfer = 200_000_000