Bump Substrate (#816)

* Amalgamate pieces of balance module

* Fixes for vesting split

* Refactoring for vesting/balances split

* Build fixes

* Remove on_free_balance_zero and some docs.

* Indentation.

* Revert branch

* Fix.

* Update substrate: fixes after CLI refactoring

* Reverting removal of exit

* Removed too much again

* Update Cargo.lock

* Cargo.lock

* Update Substrate, ready for #4820

* Fixes

* Update to latest substrate master

* Fix network tests

* Update lock

* Fix tests

* Update futures to get bug fixes

* Fix tests for new balances/vesting logic

* Cargo fix

* Another fix

Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2020-02-09 17:50:17 +01:00
committed by GitHub
parent 9a2bba3ba1
commit 703ac8bbbc
27 changed files with 1449 additions and 1509 deletions
+12 -16
View File
@@ -284,7 +284,7 @@ decl_module! {
/// Contribute to a crowd sale. This will transfer some balance over to fund a parachain
/// slot. It will be withdrawable in two instances: the parachain becomes retired; or the
/// slot is
/// slot is unable to be purchased and the timeout expires.
fn contribute(origin, #[compact] index: FundIndex, #[compact] value: BalanceOf<T>) {
let who = ensure_signed(origin)?;
@@ -599,21 +599,16 @@ mod tests {
}
parameter_types! {
pub const ExistentialDeposit: u64 = 0;
// We want to make sure these fees are non zero, so we can check
// that our module correctly avoids these fees :)
pub const TransferFee: u64 = 10;
pub const CreationFee: u64 = 10;
pub const CreationFee: u64 = 0;
}
impl balances::Trait for Test {
type Balance = u64;
type OnFreeBalanceZero = ();
type OnReapAccount = System;
type OnNewAccount = ();
type Event = ();
type DustRemoval = ();
type TransferPayment = ();
type DustRemoval = ();
type Event = ();
type ExistentialDeposit = ExistentialDeposit;
type TransferFee = TransferFee;
type CreationFee = CreationFee;
}
@@ -730,7 +725,6 @@ mod tests {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
balances::GenesisConfig::<Test>{
balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)],
vesting: vec![],
}.assimilate_storage(&mut t).unwrap();
t.into()
}
@@ -830,7 +824,7 @@ mod tests {
// User 1 contributes to their own crowdfund
assert_ok!(Crowdfund::contribute(Origin::signed(1), 0, 49));
// User 1 has spent some funds to do this, transfer fees **are** taken
assert_eq!(Balances::free_balance(1), 940);
assert_eq!(Balances::free_balance(1), 950);
// Contributions are stored in the trie
assert_eq!(Crowdfund::contribution_get(0, &1), 49);
// Contributions appear in free balance of crowdfund
@@ -1108,13 +1102,13 @@ mod tests {
// User can withdraw their full balance without fees
assert_ok!(Crowdfund::withdraw(Origin::signed(1), 0));
assert_eq!(Balances::free_balance(1), 989);
assert_eq!(Balances::free_balance(1), 999);
assert_ok!(Crowdfund::withdraw(Origin::signed(2), 0));
assert_eq!(Balances::free_balance(2), 1990);
assert_eq!(Balances::free_balance(2), 2000);
assert_ok!(Crowdfund::withdraw(Origin::signed(3), 0));
assert_eq!(Balances::free_balance(3), 2990);
assert_eq!(Balances::free_balance(3), 3000);
});
}
@@ -1126,7 +1120,7 @@ mod tests {
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
// Transfer fee is taken here
assert_ok!(Crowdfund::contribute(Origin::signed(1), 0, 49));
assert_eq!(Balances::free_balance(1), 940);
assert_eq!(Balances::free_balance(1), 950);
run_to_block(5);
@@ -1156,6 +1150,8 @@ mod tests {
// Skip all the way to the end
run_to_block(50);
// Check initiator's balance.
assert_eq!(Balances::free_balance(1), 899);
// Check current funds (contributions + deposit)
assert_eq!(Balances::free_balance(Crowdfund::fund_account_id(0)), 601);
@@ -1165,7 +1161,7 @@ mod tests {
// Fund account is emptied
assert_eq!(Balances::free_balance(Crowdfund::fund_account_id(0)), 0);
// Deposit is returned
assert_eq!(Balances::free_balance(1), 890);
assert_eq!(Balances::free_balance(1), 900);
// Treasury account is filled
assert_eq!(Balances::free_balance(Treasury::account_id()), 600);