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
@@ -70,8 +70,7 @@ pub trait Trait: system::Trait {
type WeightToFee: Convert<Weight, BalanceOf<Self>>;
/// Update the multiplier of the next block, based on the previous block's weight.
// TODO: maybe this does not need previous weight and can just read it
type FeeMultiplierUpdate: Convert<(Weight, Multiplier), Multiplier>;
type FeeMultiplierUpdate: Convert<Multiplier, Multiplier>;
}
decl_storage! {
@@ -89,9 +88,8 @@ decl_module! {
const TransactionByteFee: BalanceOf<T> = T::TransactionByteFee::get();
fn on_finalize() {
let current_weight = <system::Module<T>>::all_extrinsics_weight();
NextFeeMultiplier::mutate(|fm| {
*fm = T::FeeMultiplierUpdate::convert((current_weight, *fm))
*fm = T::FeeMultiplierUpdate::convert(*fm)
});
}
}