Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Transaction Fee Multiplier #2854

Merged
merged 77 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6c14a33
added fee calculations; need some type conversions
4meta5 Jun 12, 2019
20cc3e3
cleaned up make_payment and other stuff
4meta5 Jun 12, 2019
7e6133f
rename vars to compile
4meta5 Jun 13, 2019
3bfa6ee
add WeightToFee type
4meta5 Jun 13, 2019
a79beb2
clean test files after new type added to balances
4meta5 Jun 13, 2019
28bfe18
fmting
4meta5 Jun 13, 2019
8b686df
fix balance configs in tests
4meta5 Jun 13, 2019
a103566
more fixing mocks and tests
4meta5 Jun 13, 2019
5004f68
more comprehensive block weight limit test
4meta5 Jun 13, 2019
25016e5
fix compilation errors
4meta5 Jun 14, 2019
237f00b
more srml/executive tests && started fixing node/executor tests
4meta5 Jun 14, 2019
c473cd5
new fee multiplier; still overflows :(
4meta5 Jun 15, 2019
90501bc
perbill at the end attempt; needs to be changed
4meta5 Jun 15, 2019
838b4da
clean fmting, rename some vars
4meta5 Jun 15, 2019
074bac6
new PoC implementation.
kianenigma Jun 15, 2019
ec2d388
Merge branch 'amar/tx-fee-multiplier' of github.com:paritytech/substr…
kianenigma Jun 15, 2019
dcc8401
test weight_to_fee range and verify functionality
4meta5 Jun 18, 2019
ca81626
12 of 15 tests in node executor are passing
4meta5 Jun 19, 2019
a130696
1 test failing; big_block imports are failing for wrong reasons
4meta5 Jun 19, 2019
d9f4ffa
Update srml/executive/src/lib.rs
4meta5 Jun 22, 2019
6d8f3f0
Some cleanup.
kianenigma Jun 24, 2019
7cd2ceb
consolidate tests in runtime impls
4meta5 Jun 27, 2019
68de4b9
clean and condition executive for stateful fee range test
4meta5 Jun 28, 2019
035cb70
remove comments to self
4meta5 Jun 29, 2019
4ef0384
Major cleanup.
kianenigma Jul 1, 2019
83abfb7
Master.into() + Fix tests.
kianenigma Jul 2, 2019
e931f03
More cleanup.
kianenigma Jul 2, 2019
74e0dd1
Merge branch 'master' of github.com:paritytech/substrate into amar/tx…
kianenigma Jul 2, 2019
1297445
Fix lock files.
kianenigma Jul 2, 2019
7ad863d
Master.into()
kianenigma Jul 2, 2019
57691da
Fix build.
kianenigma Jul 2, 2019
197c703
Update node-template/runtime/Cargo.toml
4meta5 Jul 2, 2019
da9174a
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
db1bfd6
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
af39f71
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
d98232b
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
f4ce8cb
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
c5fedee
Update node/executor/src/lib.rs
4meta5 Jul 2, 2019
6bf8c1f
Per-block update.
kianenigma Jul 2, 2019
bd9b8ad
Master.into() + Fix tests.
kianenigma Jul 2, 2019
79a29c2
nit.
kianenigma Jul 2, 2019
69f391f
Update docs.
kianenigma Jul 2, 2019
c25a910
Fix contracts test.
kianenigma Jul 2, 2019
24aea1d
Stateful fee update.
kianenigma Jul 3, 2019
1578763
Master.into()
kianenigma Jul 3, 2019
480ce73
Update lock files.
kianenigma Jul 3, 2019
a7ad634
Update node/runtime/src/impls.rs
4meta5 Jul 4, 2019
75ddb98
Revamped again with fixed64.
kianenigma Jul 5, 2019
5f88b16
Merge branch 'amar/tx-fee-multiplier' of github.com:paritytech/substr…
kianenigma Jul 5, 2019
1a6033c
Master.into()
kianenigma Jul 5, 2019
6d93145
fix cargo file.
kianenigma Jul 5, 2019
3f0f30d
nits.
kianenigma Jul 5, 2019
e6db494
Some cleanup.
kianenigma Jul 6, 2019
212b666
Some nits.
kianenigma Jul 9, 2019
e00f353
Master.into()
kianenigma Jul 9, 2019
a26b8c0
Fix build.
kianenigma Jul 9, 2019
d66ff3e
Bump.
kianenigma Jul 9, 2019
e5cec3f
Rename to WeightMultiplier
kianenigma Jul 10, 2019
96aa67c
Master.into()
kianenigma Jul 10, 2019
1c07451
Update node/executor/src/lib.rs
kianenigma Jul 10, 2019
034129c
Add weight to election module mock.
kianenigma Jul 10, 2019
0f011f5
Merge branch 'amar/tx-fee-multiplier' of github.com:paritytech/substr…
kianenigma Jul 10, 2019
d0a23a2
Fix build.
kianenigma Jul 10, 2019
a94d0a3
Master.into()
kianenigma Jul 10, 2019
99bd89c
finalize merge
kianenigma Jul 10, 2019
3b29928
Update srml/system/src/lib.rs
gavofyork Jul 15, 2019
f37c690
Master.into()
kianenigma Jul 16, 2019
3e03fb3
Merge branch 'amar/tx-fee-multiplier' of github.com:paritytech/substr…
kianenigma Jul 16, 2019
73c1ad8
Bring back fees.
kianenigma Jul 16, 2019
7d21fca
Some nits.
kianenigma Jul 16, 2019
af14c50
Master.into()
kianenigma Jul 17, 2019
cb54a82
Code shifting for simplicity.
kianenigma Jul 19, 2019
257d791
Fix build + more tests.
kianenigma Jul 19, 2019
cc72a6e
Update weights.rs
gavofyork Jul 19, 2019
79aa423
Update core/sr-primitives/src/weights.rs
gavofyork Jul 19, 2019
394157d
Update lib.rs
gavofyork Jul 19, 2019
40ef12b
Fix test build
kianenigma Jul 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 83 additions & 93 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions core/sr-primitives/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
/// expression must evaluate to.
pub type Weight = u32;

/// Maximum block saturation: 4mb
pub const MAX_TRANSACTIONS_WEIGHT: u32 = 4 * 1024 * 1024;
/// Target block saturation: 25% of max block saturation = 1mb
pub const IDEAL_TRANSACTIONS_WEIGHT: u32 = 1024 * 1024;
kianenigma marked this conversation as resolved.
Show resolved Hide resolved

/// A `Call` enum (aka transaction) that can be weighted using the custom weight attribute of
/// its dispatchable functions. Is implemented by default in the `decl_module!`.
///
Expand Down
2 changes: 2 additions & 0 deletions node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ impl timestamp::Trait for Runtime {
impl balances::Trait for Runtime {
/// The type for recording an account's balance.
type Balance = u128;
/// To convert transaction weight to fee
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
type WeightToFee = ();
/// What to do if an account's free balance gets zeroed.
type OnFreeBalanceZero = ();
/// What to do if a new account is created.
Expand Down
2 changes: 0 additions & 2 deletions node-template/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>, endowed_accounts: Vec<
ids: endowed_accounts.clone(),
}),
balances: Some(BalancesConfig {
transaction_base_fee: 1,
transaction_byte_fee: 0,
existential_deposit: 500,
transfer_fee: 0,
creation_fee: 0,
Expand Down
4 changes: 0 additions & 4 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
}),
system: None,
balances: Some(BalancesConfig {
transaction_base_fee: 1 * CENTS,
transaction_byte_fee: 10 * MILLICENTS,
balances: endowed_accounts.iter().cloned()
.map(|k| (k, ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
Expand Down Expand Up @@ -269,8 +267,6 @@ pub fn testnet_genesis(
ids: endowed_accounts.clone(),
}),
balances: Some(BalancesConfig {
transaction_base_fee: 1,
transaction_byte_fee: 0,
existential_deposit: 500,
transfer_fee: 0,
creation_fee: 0,
Expand Down
26 changes: 6 additions & 20 deletions node/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
4meta5 marked this conversation as resolved.
Show resolved Hide resolved
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
4meta5 marked this conversation as resolved.
Show resolved Hide resolved
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
4meta5 marked this conversation as resolved.
Show resolved Hide resolved
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![70u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = executor().call::<_, NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -160,9 +158,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![70u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = executor().call::<_, NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -193,9 +189,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = executor().call::<_, NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -230,9 +224,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = executor().call::<_, NeverNativeValue, fn() -> _>(
Expand Down Expand Up @@ -273,8 +265,6 @@ mod tests {
ids: vec![alice(), bob(), charlie(), dave(), eve(), ferdie()],
}),
balances: Some(BalancesConfig {
transaction_base_fee: 1,
transaction_byte_fee: 0,
balances: vec![
(alice(), 111),
(bob(), 100),
Expand Down Expand Up @@ -828,9 +818,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![70u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_initialize_block", &vec![].and(&from_block_number(1u64)));
Expand All @@ -850,9 +838,7 @@ mod tests {
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
]);

let r = WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_initialize_block", &vec![].and(&from_block_number(1u64)));
Expand Down
24 changes: 24 additions & 0 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use client::{
};
use runtime_primitives::{ApplyResult, generic, create_runtime_str};
use runtime_primitives::transaction_validity::TransactionValidity;
use runtime_primitives::weights::{Weight, IDEAL_TRANSACTIONS_WEIGHT};
use runtime_primitives::traits::{
BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup, AuthorityIdFor, Convert,
};
Expand Down Expand Up @@ -86,6 +87,28 @@ impl Convert<u128, u128> for CurrencyToVoteHandler {
fn convert(x: u128) -> u128 { x * Self::factor() }
}

pub struct WeightToFeeHandler;

impl Convert<Weight, Balance> for WeightToFeeHandler {
fn convert(weight: Weight) -> Balance {
// 40/1000000 = 4/100000 = 4/10^5 = 0.00004
let variability_fee = Permill::from_parts(40);
// 0.00004^2 = 16/10^10 ~= 2/10^9
let variability_fee_squared = Perbill::from_parts(2);
let potential_weight = <system::Module<Runtime>>::all_extrinsics_weight() + weight;
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
let high_fee: bool = IDEAL_TRANSACTIONS_WEIGHT <= potential_weight;
// workaround because unsigned cannot be negative
let diff = if high_fee { potential_weight - IDEAL_TRANSACTIONS_WEIGHT }
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
else { IDEAL_TRANSACTIONS_WEIGHT - potential_weight};
let first_term = variability_fee * diff;
let second_term = variability_fee_squared * diff * diff / 2;
let fee_multiplier = if high_fee { 1 + first_term + second_term }
else { 1 + second_term - first_term };
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
let transaction_fee = weight * fee_multiplier;
transaction_fee.into()
}
}

impl system::Trait for Runtime {
type Origin = Origin;
type Index = Index;
Expand Down Expand Up @@ -113,6 +136,7 @@ impl indices::Trait for Runtime {

impl balances::Trait for Runtime {
type Balance = Balance;
type WeightToFee = WeightToFeeHandler;
type OnFreeBalanceZero = ((Staking, Contract), Session);
type OnNewAccount = Indices;
type Event = Event;
Expand Down
20 changes: 12 additions & 8 deletions srml/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ use srml_support::traits::{
};
use srml_support::dispatch::Result;
use primitives::traits::{
Zero, SimpleArithmetic, StaticLookup, Member, CheckedAdd, CheckedSub,
Zero, Convert, SimpleArithmetic, StaticLookup, Member, CheckedAdd, CheckedSub,
MaybeSerializeDebug, Saturating
};
use primitives::weights::Weight;
use system::{IsDeadAccount, OnNewAccount, ensure_signed};

mod mock;
Expand All @@ -171,6 +172,9 @@ pub trait Subtrait<I: Instance = DefaultInstance>: system::Trait {
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy +
MaybeSerializeDebug + From<Self::BlockNumber>;

/// Handler for converting transactions weights to fees
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
type WeightToFee: Convert<Weight, Self::Balance>;

/// A function that is invoked when the free-balance has fallen below the existential deposit and
/// has been reduced to zero.
///
Expand All @@ -186,6 +190,9 @@ pub trait Trait<I: Instance = DefaultInstance>: system::Trait {
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy +
MaybeSerializeDebug + From<Self::BlockNumber>;

/// Handler for converting transaction weights to fees
type WeightToFee: Convert<Weight, Self::Balance>;

/// A function that is invoked when the free-balance has fallen below the existential deposit and
/// has been reduced to zero.
///
Expand All @@ -211,6 +218,7 @@ pub trait Trait<I: Instance = DefaultInstance>: system::Trait {

impl<T: Trait<I>, I: Instance> Subtrait<I> for T {
type Balance = T::Balance;
type WeightToFee = T::WeightToFee;
type OnFreeBalanceZero = T::OnFreeBalanceZero;
type OnNewAccount = T::OnNewAccount;
}
Expand Down Expand Up @@ -273,10 +281,6 @@ decl_storage! {
pub TransferFee get(transfer_fee) config(): T::Balance;
/// The fee required to create an account.
pub CreationFee get(creation_fee) config(): T::Balance;
/// The fee to be paid for making a transaction; the base.
pub TransactionBaseFee get(transaction_base_fee) config(): T::Balance;
/// The fee to be paid for making a transaction; the per-byte portion.
pub TransactionByteFee get(transaction_byte_fee) config(): T::Balance;

/// Information regarding the vesting of a given account.
pub Vesting get(vesting) build(|config: &GenesisConfig<T, I>| {
Expand Down Expand Up @@ -684,6 +688,7 @@ impl<T: Subtrait<I>, I: Instance> system::Trait for ElevatedTrait<T, I> {
}
impl<T: Subtrait<I>, I: Instance> Trait<I> for ElevatedTrait<T, I> {
type Balance = T::Balance;
type WeightToFee = T::WeightToFee;
type OnFreeBalanceZero = T::OnFreeBalanceZero;
type OnNewAccount = T::OnNewAccount;
type Event = ();
Expand Down Expand Up @@ -1040,9 +1045,8 @@ where
}

impl<T: Trait<I>, I: Instance> MakePayment<T::AccountId> for Module<T, I> {
fn make_payment(transactor: &T::AccountId, encoded_len: usize) -> Result {
let encoded_len = T::Balance::from(encoded_len as u32);
let transaction_fee = Self::transaction_base_fee() + Self::transaction_byte_fee() * encoded_len;
fn make_payment(transactor: &T::AccountId, weight: Weight) -> Result {
let transaction_fee = T::WeightToFee::convert(weight);
let imbalance = Self::withdraw(
transactor,
transaction_fee,
Expand Down
12 changes: 1 addition & 11 deletions srml/balances/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl system::Trait for Runtime {
}
impl Trait for Runtime {
type Balance = u64;
type WeightToFee = ();
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type Event = ();
Expand All @@ -56,8 +57,6 @@ impl Trait for Runtime {
}

pub struct ExtBuilder {
transaction_base_fee: u64,
transaction_byte_fee: u64,
existential_deposit: u64,
transfer_fee: u64,
creation_fee: u64,
Expand All @@ -67,8 +66,6 @@ pub struct ExtBuilder {
impl Default for ExtBuilder {
fn default() -> Self {
Self {
transaction_base_fee: 0,
transaction_byte_fee: 0,
existential_deposit: 0,
transfer_fee: 0,
creation_fee: 0,
Expand All @@ -91,11 +88,6 @@ impl ExtBuilder {
self.creation_fee = creation_fee;
self
}
pub fn transaction_fees(mut self, base_fee: u64, byte_fee: u64) -> Self {
self.transaction_base_fee = base_fee;
self.transaction_byte_fee = byte_fee;
self
}
pub fn monied(mut self, monied: bool) -> Self {
self.monied = monied;
if self.existential_deposit == 0 {
Expand All @@ -110,8 +102,6 @@ impl ExtBuilder {
pub fn build(self) -> runtime_io::TestExternalities<Blake2Hasher> {
let mut t = system::GenesisConfig::<Runtime>::default().build_storage().unwrap().0;
t.extend(GenesisConfig::<Runtime> {
transaction_base_fee: self.transaction_base_fee,
transaction_byte_fee: self.transaction_byte_fee,
balances: if self.monied {
vec![(1, 10 * self.existential_deposit), (2, 20 * self.existential_deposit), (3, 30 * self.existential_deposit), (4, 40 * self.existential_deposit)]
} else {
Expand Down
2 changes: 1 addition & 1 deletion srml/balances/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn lock_value_extension_should_work() {

#[test]
fn lock_reasons_should_work() {
with_externalities(&mut ExtBuilder::default().existential_deposit(1).monied(true).transaction_fees(0, 1).build(), || {
with_externalities(&mut ExtBuilder::default().existential_deposit(1).monied(true).build(), || {
Balances::set_lock(ID_1, &1, 10, u64::max_value(), WithdrawReason::Transfer.into());
assert_noop!(<Balances as Currency<_>>::transfer(&1, &2, 1), "account liquidity restrictions prevent withdrawal");
assert_ok!(<Balances as ReservableCurrency<_>>::reserve(&1, 1));
Expand Down
3 changes: 1 addition & 2 deletions srml/contract/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl system::Trait for Test {
}
impl balances::Trait for Test {
type Balance = u64;
type WeightToFee = ();
type OnFreeBalanceZero = Contract;
type OnNewAccount = ();
type Event = MetaEvent;
Expand Down Expand Up @@ -197,8 +198,6 @@ impl ExtBuilder {
.0;
t.extend(
balances::GenesisConfig::<Test> {
transaction_base_fee: 0,
transaction_byte_fee: 0,
balances: vec![],
existential_deposit: self.existential_deposit,
transfer_fee: self.transfer_fee,
Expand Down
3 changes: 1 addition & 2 deletions srml/council/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ mod tests {
}
impl balances::Trait for Test {
type Balance = u64;
type WeightToFee = ();
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type Event = Event;
Expand Down Expand Up @@ -176,8 +177,6 @@ mod tests {
pub fn build(self) -> runtime_io::TestExternalities<Blake2Hasher> {
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap().0;
t.extend(balances::GenesisConfig::<Test>{
transaction_base_fee: 0,
transaction_byte_fee: 0,
balances: vec![
(1, 10 * self.balance_factor),
(2, 20 * self.balance_factor),
Expand Down
3 changes: 1 addition & 2 deletions srml/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ mod tests {
}
impl balances::Trait for Test {
type Balance = u64;
type WeightToFee = ();
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type Event = ();
Expand Down Expand Up @@ -1003,8 +1004,6 @@ mod tests {
fn new_test_ext() -> runtime_io::TestExternalities<Blake2Hasher> {
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap().0;
t.extend(balances::GenesisConfig::<Test>{
transaction_base_fee: 0,
transaction_byte_fee: 0,
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
existential_deposit: 0,
transfer_fee: 0,
Expand Down
1 change: 1 addition & 0 deletions srml/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ mod tests {
}
impl balances::Trait for Test {
type Balance = u64;
type WeightToFee = ();
type OnFreeBalanceZero = ();
type OnNewAccount = ();
type Event = ();
Expand Down
Loading