Transaction Fee Module (#1648)

* wip

* Split bytes fee charging and charging by amount into different traits.

* Move to edition 2018.

* Implemented charge fee traits for fees module.

* Implemented 'on_finalise' for fee module.

* Updated fees finalize impl.

* Renaming and documentation update.

* Added overflow & underflow check for fee calculation.

* Added mock and unit tests for fee module.

* More unit tests for fees module.

* Fixed srml-executive unit tests.

* Remove transaction base/bytes fee from balances module, fix unit tests.

* fix compile error

* Fixed unit test.

* Minor fixes.

* Bump spec version.

* Bump spec version.

* Updated fees module and runtime wasm.

* Fees module code style improvement; updated runtime wasm.

* Bump spec and impl version.
This commit is contained in:
Xiliang Chen
2019-02-15 23:21:38 +13:00
committed by Bastian Köcher
parent 6a6c3155a6
commit fafffdb771
31 changed files with 672 additions and 90 deletions
+9 -2
View File
@@ -60,7 +60,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("node"),
impl_name: create_runtime_str!("substrate-node"),
authoring_version: 10,
spec_version: 28,
spec_version: 29,
impl_version: 29,
apis: RUNTIME_API_VERSIONS,
};
@@ -107,6 +107,12 @@ impl balances::Trait for Runtime {
type Event = Event;
}
impl fees::Trait for Runtime {
type Event = Event;
type Amount = Balance;
type TransferAsset = Balances;
}
impl consensus::Trait for Runtime {
type Log = Log;
type SessionKey = SessionKey;
@@ -210,6 +216,7 @@ construct_runtime!(
Treasury: treasury,
Contract: contract::{Module, Call, Storage, Config<T>, Event<T>},
Sudo: sudo,
Fees: fees::{Module, Storage, Config<T>, Event<T>},
}
);
@@ -228,7 +235,7 @@ pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic<Address,
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Balances, AllModules>;
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Fees, AllModules>;
impl_runtime_apis! {
impl client_api::Core<Block> for Runtime {