BREAKING: Rename Origin (#12258)

* BREAKING: Rename Origin

* more renaming

* a bit more renaming

* fix

* more fixing

* fix in frame_support

* even more fixes

* fix

* small fix

* ...

* update .stderr

* docs

* update docs

* update docs

* docs
This commit is contained in:
Sergej Sakac
2022-09-21 00:13:09 +02:00
committed by GitHub
parent 986d20b352
commit e4b6f4a66d
221 changed files with 5233 additions and 4200 deletions
@@ -24,53 +24,56 @@ fn veto_external_works() {
new_test_ext().execute_with(|| {
System::set_block_number(0);
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(2),
));
assert!(<NextExternal<Test>>::exists());
let h = set_balance_proposal_hash_and_note(2);
assert_ok!(Democracy::veto_external(Origin::signed(3), h));
assert_ok!(Democracy::veto_external(RuntimeOrigin::signed(3), h));
// cancelled.
assert!(!<NextExternal<Test>>::exists());
// fails - same proposal can't be resubmitted.
assert_noop!(
Democracy::external_propose(Origin::signed(2), set_balance_proposal_hash(2),),
Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal_hash(2),),
Error::<Test>::ProposalBlacklisted
);
fast_forward_to(1);
// fails as we're still in cooloff period.
assert_noop!(
Democracy::external_propose(Origin::signed(2), set_balance_proposal_hash(2),),
Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal_hash(2),),
Error::<Test>::ProposalBlacklisted
);
fast_forward_to(2);
// works; as we're out of the cooloff period.
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(2),
));
assert!(<NextExternal<Test>>::exists());
// 3 can't veto the same thing twice.
assert_noop!(Democracy::veto_external(Origin::signed(3), h), Error::<Test>::AlreadyVetoed);
assert_noop!(
Democracy::veto_external(RuntimeOrigin::signed(3), h),
Error::<Test>::AlreadyVetoed
);
// 4 vetoes.
assert_ok!(Democracy::veto_external(Origin::signed(4), h));
assert_ok!(Democracy::veto_external(RuntimeOrigin::signed(4), h));
// cancelled again.
assert!(!<NextExternal<Test>>::exists());
fast_forward_to(3);
// same proposal fails as we're still in cooloff
assert_noop!(
Democracy::external_propose(Origin::signed(2), set_balance_proposal_hash(2),),
Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal_hash(2),),
Error::<Test>::ProposalBlacklisted
);
// different proposal works fine.
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(3),
));
});
@@ -82,18 +85,21 @@ fn external_blacklisting_should_work() {
System::set_block_number(0);
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(2),
));
let hash = set_balance_proposal_hash(2);
assert_ok!(Democracy::blacklist(Origin::root(), hash, None));
assert_ok!(Democracy::blacklist(RuntimeOrigin::root(), hash, None));
fast_forward_to(2);
assert_noop!(Democracy::referendum_status(0), Error::<Test>::ReferendumInvalid);
assert_noop!(
Democracy::external_propose(Origin::signed(2), set_balance_proposal_hash_and_note(2),),
Democracy::external_propose(
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(2),
),
Error::<Test>::ProposalBlacklisted,
);
});
@@ -104,15 +110,15 @@ fn external_referendum_works() {
new_test_ext().execute_with(|| {
System::set_block_number(0);
assert_noop!(
Democracy::external_propose(Origin::signed(1), set_balance_proposal_hash(2),),
Democracy::external_propose(RuntimeOrigin::signed(1), set_balance_proposal_hash(2),),
BadOrigin,
);
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(2),
));
assert_noop!(
Democracy::external_propose(Origin::signed(2), set_balance_proposal_hash(1),),
Democracy::external_propose(RuntimeOrigin::signed(2), set_balance_proposal_hash(1),),
Error::<Test>::DuplicateProposal
);
fast_forward_to(2);
@@ -134,11 +140,14 @@ fn external_majority_referendum_works() {
new_test_ext().execute_with(|| {
System::set_block_number(0);
assert_noop!(
Democracy::external_propose_majority(Origin::signed(1), set_balance_proposal_hash(2)),
Democracy::external_propose_majority(
RuntimeOrigin::signed(1),
set_balance_proposal_hash(2)
),
BadOrigin,
);
assert_ok!(Democracy::external_propose_majority(
Origin::signed(3),
RuntimeOrigin::signed(3),
set_balance_proposal_hash_and_note(2)
));
fast_forward_to(2);
@@ -160,11 +169,14 @@ fn external_default_referendum_works() {
new_test_ext().execute_with(|| {
System::set_block_number(0);
assert_noop!(
Democracy::external_propose_default(Origin::signed(3), set_balance_proposal_hash(2)),
Democracy::external_propose_default(
RuntimeOrigin::signed(3),
set_balance_proposal_hash(2)
),
BadOrigin,
);
assert_ok!(Democracy::external_propose_default(
Origin::signed(1),
RuntimeOrigin::signed(1),
set_balance_proposal_hash_and_note(2)
));
fast_forward_to(2);
@@ -186,7 +198,7 @@ fn external_and_public_interleaving_works() {
new_test_ext().execute_with(|| {
System::set_block_number(0);
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(1),
));
assert_ok!(propose_set_balance_and_note(6, 2, 2));
@@ -206,7 +218,7 @@ fn external_and_public_interleaving_works() {
);
// replenish external
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(3),
));
@@ -240,7 +252,7 @@ fn external_and_public_interleaving_works() {
);
// replenish external
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(5),
));
@@ -259,7 +271,7 @@ fn external_and_public_interleaving_works() {
);
// replenish both
assert_ok!(Democracy::external_propose(
Origin::signed(2),
RuntimeOrigin::signed(2),
set_balance_proposal_hash_and_note(7),
));
assert_ok!(propose_set_balance_and_note(6, 4, 2));
@@ -281,7 +293,7 @@ fn external_and_public_interleaving_works() {
assert_ok!(propose_set_balance_and_note(6, 6, 2));
// cancel external
let h = set_balance_proposal_hash_and_note(7);
assert_ok!(Democracy::veto_external(Origin::signed(3), h));
assert_ok!(Democracy::veto_external(RuntimeOrigin::signed(3), h));
fast_forward_to(12);