Prevent events from being emitted during genesis construction (#5463)

* Don't populate runtime events in genesis

* typo

* Change to block zero

* Fix vesting tests

* Update frame/system/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update frame/system/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Add test

* Fix test

* Fix contract tests

* Fix phragmen tests

* Fix Generic Assets Tests

* Fix offences tests

* Fix im-online

* fix recovery

* Fix utility tests

* Shorter

* Use ext

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-03-31 15:57:08 +02:00
committed by GitHub
parent b472d60a52
commit 2e76e2a74d
22 changed files with 72 additions and 109 deletions
+3 -9
View File
@@ -452,7 +452,9 @@ mod tests {
(12, 10, 20, 5 * self.existential_deposit)
],
}.assimilate_storage(&mut t).unwrap();
t.into()
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
}
}
@@ -462,7 +464,6 @@ mod tests {
.existential_deposit(256)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user1_free_balance = Balances::free_balance(&1);
let user2_free_balance = Balances::free_balance(&2);
let user12_free_balance = Balances::free_balance(&12);
@@ -521,7 +522,6 @@ mod tests {
.existential_deposit(10)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user1_free_balance = Balances::free_balance(&1);
assert_eq!(user1_free_balance, 100); // Account 1 has free balance
// Account 1 has only 5 units vested at block 1 (plus 50 unvested)
@@ -539,7 +539,6 @@ mod tests {
.existential_deposit(10)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user1_free_balance = Balances::free_balance(&1);
assert_eq!(user1_free_balance, 100); // Account 1 has free balance
// Account 1 has only 5 units vested at block 1 (plus 50 unvested)
@@ -555,7 +554,6 @@ mod tests {
.existential_deposit(10)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user1_free_balance = Balances::free_balance(&1);
assert_eq!(user1_free_balance, 100); // Account 1 has free balance
// Account 1 has only 5 units vested at block 1 (plus 50 unvested)
@@ -571,7 +569,6 @@ mod tests {
.existential_deposit(10)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
assert_ok!(Balances::transfer(Some(3).into(), 1, 100));
assert_ok!(Balances::transfer(Some(3).into(), 2, 100));
@@ -599,7 +596,6 @@ mod tests {
.existential_deposit(256)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user12_free_balance = Balances::free_balance(&12);
assert_eq!(user12_free_balance, 2560); // Account 12 has free balance
@@ -625,7 +621,6 @@ mod tests {
.existential_deposit(256)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user3_free_balance = Balances::free_balance(&3);
let user4_free_balance = Balances::free_balance(&4);
assert_eq!(user3_free_balance, 256 * 30);
@@ -669,7 +664,6 @@ mod tests {
.existential_deposit(256)
.build()
.execute_with(|| {
assert_eq!(System::block_number(), 1);
let user2_free_balance = Balances::free_balance(&2);
let user4_free_balance = Balances::free_balance(&4);
assert_eq!(user2_free_balance, 256 * 20);