mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
Feedback from @XLC for Referenda Pallet (#10991)
* feedback from @xlc * english * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -47,7 +47,7 @@ fn basic_happy_path_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
set_balance_proposal_hash(1),
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_eq!(Balances::reserved_balance(&1), 2);
|
||||
assert_eq!(ReferendumCount::<Test>::get(), 1);
|
||||
@@ -178,7 +178,7 @@ fn queueing_works() {
|
||||
Origin::signed(5),
|
||||
RawOrigin::Root.into(),
|
||||
set_balance_proposal_hash(0),
|
||||
AtOrAfter::After(0),
|
||||
DispatchTime::After(0),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(5), 0));
|
||||
|
||||
@@ -190,7 +190,7 @@ fn queueing_works() {
|
||||
Origin::signed(i),
|
||||
RawOrigin::Root.into(),
|
||||
set_balance_proposal_hash(i),
|
||||
AtOrAfter::After(0),
|
||||
DispatchTime::After(0),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(i), i as u32));
|
||||
// TODO: decision deposit after some initial votes with a non-highest voted coming
|
||||
@@ -275,7 +275,7 @@ fn auto_timeout_should_happen_with_nothing_but_submit() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
set_balance_proposal_hash(1),
|
||||
AtOrAfter::At(20),
|
||||
DispatchTime::At(20),
|
||||
));
|
||||
run_to(20);
|
||||
assert_matches!(ReferendumInfoFor::<Test>::get(0), Some(ReferendumInfo::Ongoing(..)));
|
||||
@@ -295,13 +295,13 @@ fn tracks_are_distinguished() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
set_balance_proposal_hash(1),
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_ok!(Referenda::submit(
|
||||
Origin::signed(2),
|
||||
RawOrigin::None.into(),
|
||||
set_balance_proposal_hash(2),
|
||||
AtOrAfter::At(20),
|
||||
DispatchTime::At(20),
|
||||
));
|
||||
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(3), 0));
|
||||
@@ -318,7 +318,7 @@ fn tracks_are_distinguished() {
|
||||
track: 0,
|
||||
origin: OriginCaller::system(RawOrigin::Root),
|
||||
proposal_hash: set_balance_proposal_hash(1),
|
||||
enactment: AtOrAfter::At(10),
|
||||
enactment: DispatchTime::At(10),
|
||||
submitted: 1,
|
||||
submission_deposit: Deposit { who: 1, amount: 2 },
|
||||
decision_deposit: Some(Deposit { who: 3, amount: 10 }),
|
||||
@@ -334,7 +334,7 @@ fn tracks_are_distinguished() {
|
||||
track: 1,
|
||||
origin: OriginCaller::system(RawOrigin::None),
|
||||
proposal_hash: set_balance_proposal_hash(2),
|
||||
enactment: AtOrAfter::At(20),
|
||||
enactment: DispatchTime::At(20),
|
||||
submitted: 1,
|
||||
submission_deposit: Deposit { who: 2, amount: 2 },
|
||||
decision_deposit: Some(Deposit { who: 4, amount: 1 }),
|
||||
@@ -355,13 +355,18 @@ fn submit_errors_work() {
|
||||
let h = set_balance_proposal_hash(1);
|
||||
// No track for Signed origins.
|
||||
assert_noop!(
|
||||
Referenda::submit(Origin::signed(1), RawOrigin::Signed(2).into(), h, AtOrAfter::At(10),),
|
||||
Referenda::submit(
|
||||
Origin::signed(1),
|
||||
RawOrigin::Signed(2).into(),
|
||||
h,
|
||||
DispatchTime::At(10),
|
||||
),
|
||||
Error::<Test>::NoTrack
|
||||
);
|
||||
|
||||
// No funds for deposit
|
||||
assert_noop!(
|
||||
Referenda::submit(Origin::signed(10), RawOrigin::Root.into(), h, AtOrAfter::At(10),),
|
||||
Referenda::submit(Origin::signed(10), RawOrigin::Root.into(), h, DispatchTime::At(10),),
|
||||
BalancesError::<Test>::InsufficientBalance
|
||||
);
|
||||
});
|
||||
@@ -378,13 +383,13 @@ fn decision_deposit_errors_work() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
let e = BalancesError::<Test>::InsufficientBalance;
|
||||
assert_noop!(Referenda::place_decision_deposit(Origin::signed(10), 0), e);
|
||||
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(2), 0));
|
||||
let e = Error::<Test>::HaveDeposit;
|
||||
let e = Error::<Test>::HasDeposit;
|
||||
assert_noop!(Referenda::place_decision_deposit(Origin::signed(2), 0), e);
|
||||
});
|
||||
}
|
||||
@@ -400,7 +405,7 @@ fn refund_deposit_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
let e = Error::<Test>::NoDeposit;
|
||||
assert_noop!(Referenda::refund_decision_deposit(Origin::signed(2), 0), e);
|
||||
@@ -422,7 +427,7 @@ fn cancel_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(2), 0));
|
||||
|
||||
@@ -441,7 +446,7 @@ fn cancel_errors_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(2), 0));
|
||||
assert_noop!(Referenda::cancel(Origin::signed(1), 0), BadOrigin);
|
||||
@@ -459,7 +464,7 @@ fn kill_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(2), 0));
|
||||
|
||||
@@ -479,7 +484,7 @@ fn kill_errors_works() {
|
||||
Origin::signed(1),
|
||||
RawOrigin::Root.into(),
|
||||
h,
|
||||
AtOrAfter::At(10),
|
||||
DispatchTime::At(10),
|
||||
));
|
||||
assert_ok!(Referenda::place_decision_deposit(Origin::signed(2), 0));
|
||||
assert_noop!(Referenda::kill(Origin::signed(4), 0), BadOrigin);
|
||||
|
||||
Reference in New Issue
Block a user