Better Parameterisation for Fee system (#3823)

* Better fee parameters

* Fix build

* Better runtime tests

* Price to Weight ratio as type parameter (#3856)

* Price to Weight ration as type parameter

* Kian feedback

* Some renames.

* Fix executor tests

* Getting Closer.

* Phantom Data

* Actually fix executor tests.

* Fix tests.

* Remove todo

* Fix build
This commit is contained in:
Kian Paimani
2019-10-24 15:03:52 +02:00
committed by Gavin Wood
parent 022126f906
commit ecd1ed7b65
10 changed files with 214 additions and 186 deletions
+4 -7
View File
@@ -38,9 +38,7 @@ mod tests {
use super::Executor;
use {balances, contracts, indices, system, timestamp};
use codec::{Encode, Decode, Joiner};
use runtime_support::{
Hashable, StorageValue, StorageMap, traits::Currency,
};
use runtime_support::{Hashable, StorageValue, StorageMap, traits::Currency};
use state_machine::TestExternalities as CoreTestExternalities;
use primitives::{
Blake2Hasher, NeverNativeValue, NativeOrEncoded, map,
@@ -57,8 +55,9 @@ mod tests {
use node_runtime::{
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances, BuildStorage,
System, TransactionPayment, Event, TransferFee, TransactionBaseFee, TransactionByteFee,
constants::currency::*, impls::WeightToFee,
WeightFeeCoefficient, constants::currency::*,
};
use node_runtime::impls::LinearWeightToFee;
use node_primitives::{Balance, Hash, BlockNumber};
use node_testing::keyring::*;
use wabt;
@@ -501,8 +500,6 @@ mod tests {
).0.unwrap();
t.execute_with(|| {
// NOTE: fees differ slightly in tests that execute more than one block due to the
// weight update. Hence, using `assert_eq_error_rate`.
assert_eq!(
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - transfer_fee(&xt(), fm),
@@ -1069,7 +1066,7 @@ mod tests {
balance_alice -= length_fee;
let weight = default_transfer_call().get_dispatch_info().weight;
let weight_fee = WeightToFee::convert(weight);
let weight_fee = LinearWeightToFee::<WeightFeeCoefficient>::convert(weight);
// we know that weight to fee multiplier is effect-less in block 1.
assert_eq!(weight_fee as Balance, MILLICENTS);