mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 18:37:59 +00:00
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:
@@ -21,7 +21,6 @@ use super::*;
|
||||
#[test]
|
||||
fn cancel_referendum_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
|
||||
@@ -140,7 +140,6 @@ fn no_locks_without_conviction_should_work() {
|
||||
#[test]
|
||||
fn lock_voting_should_work_with_delegation() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::*;
|
||||
#[test]
|
||||
fn missing_preimage_should_fail() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash(2),
|
||||
@@ -40,7 +39,6 @@ fn missing_preimage_should_fail() {
|
||||
#[test]
|
||||
fn preimage_deposit_should_be_required_and_returned() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
// fee of 100 is too much.
|
||||
PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 100);
|
||||
assert_noop!(
|
||||
@@ -71,7 +69,6 @@ fn preimage_deposit_should_be_required_and_returned() {
|
||||
#[test]
|
||||
fn preimage_deposit_should_be_reapable_earlier_by_owner() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1);
|
||||
assert_ok!(Democracy::note_preimage(Origin::signed(6), set_balance_proposal(2)));
|
||||
|
||||
@@ -93,7 +90,6 @@ fn preimage_deposit_should_be_reapable_earlier_by_owner() {
|
||||
#[test]
|
||||
fn preimage_deposit_should_be_reapable() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_noop!(
|
||||
Democracy::reap_preimage(Origin::signed(5), set_balance_proposal_hash(2)),
|
||||
Error::<Test>::PreimageMissing
|
||||
@@ -122,7 +118,6 @@ fn preimage_deposit_should_be_reapable() {
|
||||
#[test]
|
||||
fn noting_imminent_preimage_for_free_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
PREIMAGE_BYTE_DEPOSIT.with(|v| *v.borrow_mut() = 1);
|
||||
|
||||
let r = Democracy::inject_referendum(
|
||||
@@ -152,7 +147,6 @@ fn noting_imminent_preimage_for_free_should_work() {
|
||||
#[test]
|
||||
fn reaping_imminent_preimage_should_fail() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let h = set_balance_proposal_hash_and_note(2);
|
||||
let r = Democracy::inject_referendum(3, h, VoteThreshold::SuperMajorityApprove, 1);
|
||||
assert_ok!(Democracy::vote(Origin::signed(1), r, aye(1)));
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::*;
|
||||
#[test]
|
||||
fn backing_for_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_ok!(propose_set_balance_and_note(1, 2, 2));
|
||||
assert_ok!(propose_set_balance_and_note(1, 4, 4));
|
||||
assert_ok!(propose_set_balance_and_note(1, 3, 3));
|
||||
@@ -34,7 +33,6 @@ fn backing_for_should_work() {
|
||||
#[test]
|
||||
fn deposit_for_proposals_should_be_taken() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_ok!(propose_set_balance_and_note(1, 2, 5));
|
||||
assert_ok!(Democracy::second(Origin::signed(2), 0));
|
||||
assert_ok!(Democracy::second(Origin::signed(5), 0));
|
||||
@@ -49,7 +47,6 @@ fn deposit_for_proposals_should_be_taken() {
|
||||
#[test]
|
||||
fn deposit_for_proposals_should_be_returned() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_ok!(propose_set_balance_and_note(1, 2, 5));
|
||||
assert_ok!(Democracy::second(Origin::signed(2), 0));
|
||||
assert_ok!(Democracy::second(Origin::signed(5), 0));
|
||||
@@ -65,7 +62,6 @@ fn deposit_for_proposals_should_be_returned() {
|
||||
#[test]
|
||||
fn proposal_with_deposit_below_minimum_should_not_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_noop!(propose_set_balance(1, 2, 0), Error::<Test>::ValueLow);
|
||||
});
|
||||
}
|
||||
@@ -73,7 +69,6 @@ fn proposal_with_deposit_below_minimum_should_not_work() {
|
||||
#[test]
|
||||
fn poor_proposer_should_not_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_noop!(propose_set_balance(1, 2, 11), BalancesError::<Test, _>::InsufficientBalance);
|
||||
});
|
||||
}
|
||||
@@ -81,7 +76,6 @@ fn poor_proposer_should_not_work() {
|
||||
#[test]
|
||||
fn poor_seconder_should_not_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
assert_ok!(propose_set_balance_and_note(2, 2, 11));
|
||||
assert_noop!(Democracy::second(Origin::signed(1), 0), BalancesError::<Test, _>::InsufficientBalance);
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ use super::*;
|
||||
#[test]
|
||||
fn simple_passing_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
@@ -39,7 +38,6 @@ fn simple_passing_should_work() {
|
||||
#[test]
|
||||
fn simple_failing_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
@@ -59,7 +57,6 @@ fn simple_failing_should_work() {
|
||||
#[test]
|
||||
fn ooo_inject_referendums_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r1 = Democracy::inject_referendum(
|
||||
3,
|
||||
set_balance_proposal_hash_and_note(3),
|
||||
@@ -90,7 +87,6 @@ fn ooo_inject_referendums_should_work() {
|
||||
#[test]
|
||||
fn delayed_enactment_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
|
||||
@@ -99,7 +99,6 @@ fn single_proposal_should_work() {
|
||||
#[test]
|
||||
fn controversial_voting_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
@@ -126,7 +125,6 @@ fn controversial_voting_should_work() {
|
||||
#[test]
|
||||
fn controversial_low_turnout_voting_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
@@ -151,7 +149,6 @@ fn passing_low_turnout_voting_should_work() {
|
||||
assert_eq!(Balances::free_balance(42), 0);
|
||||
assert_eq!(Balances::total_issuance(), 210);
|
||||
|
||||
System::set_block_number(1);
|
||||
let r = Democracy::inject_referendum(
|
||||
2,
|
||||
set_balance_proposal_hash_and_note(2),
|
||||
|
||||
Reference in New Issue
Block a user