mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 11:57:56 +00:00
Fix invalid state transitions in pallet-bounties (#11630)
* Pallet-bounty: disallow invalid state transitions * Fix tests: funding only at even block numbers * Fix benchmarks: bounties need to be funded * fix on_initialize Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -390,7 +390,7 @@ pub mod pallet {
|
||||
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
||||
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
|
||||
match bounty.status {
|
||||
BountyStatus::Proposed | BountyStatus::Approved | BountyStatus::Funded => {},
|
||||
BountyStatus::Funded => {},
|
||||
_ => return Err(Error::<T, I>::UnexpectedStatus.into()),
|
||||
};
|
||||
|
||||
|
||||
@@ -1126,8 +1126,8 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), value, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), bounty_index));
|
||||
|
||||
System::set_block_number(3);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(3);
|
||||
System::set_block_number(4);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(4);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), bounty_index, user, fee));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(user), bounty_index));
|
||||
@@ -1150,8 +1150,8 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), value, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), bounty_index));
|
||||
|
||||
System::set_block_number(3);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(3);
|
||||
System::set_block_number(6);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(6);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), bounty_index, user, fee));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(user), bounty_index));
|
||||
|
||||
Reference in New Issue
Block a user