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
+11 -7
View File
@@ -20,7 +20,7 @@ use primitives::{Ed25519AuthorityId, ed25519};
use node_primitives::AccountId;
use node_runtime::{ConsensusConfig, CouncilSeatsConfig, CouncilVotingConfig, DemocracyConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, TreasuryConfig,
SudoConfig, ContractConfig, GrandpaConfig, IndicesConfig, Permill, Perbill};
SudoConfig, ContractConfig, GrandpaConfig, IndicesConfig, FeesConfig, Permill, Perbill};
pub use node_runtime::GenesisConfig;
use substrate_service;
use hex_literal::{hex, hex_impl};
@@ -64,8 +64,6 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
system: None,
balances: Some(BalancesConfig {
balances: endowed_accounts.iter().map(|&k| (k, 10_000_000 * DOLLARS)).collect(),
transaction_base_fee: 1 * CENTS,
transaction_byte_fee: 10 * MILLICENTS,
existential_deposit: 1 * DOLLARS,
transfer_fee: 1 * CENTS,
creation_fee: 1 * CENTS,
@@ -139,7 +137,11 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.clone().into_iter().map(|k| (k, 1)).collect(),
})
}),
fees: Some(FeesConfig {
transaction_base_fee: 1 * CENTS,
transaction_byte_fee: 10 * MILLICENTS,
}),
}
}
@@ -192,8 +194,6 @@ pub fn testnet_genesis(
ids: endowed_accounts.iter().map(|x| x.0.into()).collect(),
}),
balances: Some(BalancesConfig {
transaction_base_fee: 1,
transaction_byte_fee: 0,
existential_deposit: 500,
transfer_fee: 0,
creation_fee: 0,
@@ -267,7 +267,11 @@ pub fn testnet_genesis(
}),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.clone().into_iter().map(|k| (k, 1)).collect(),
})
}),
fees: Some(FeesConfig {
transaction_base_fee: 1,
transaction_byte_fee: 0,
}),
}
}