Adds remove_approval feature to treasury pallet (#11243)

* added remove_approval feature to treasury pallet

* Update frame/treasury/src/lib.rs

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>

* treasury pallet refactoring: removed proposalId check in remove_approval call and trailing new line in tests file

* fmt

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_treasury --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/treasury/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Update frame/treasury/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* remove_approval extrinsic in treasury pallet:added extra checks in test and extra documentation

* refactored error logging on remove_approval extrinsic in treasury pallet

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Chigozie Joshua
2022-04-27 10:23:46 +01:00
committed by GitHub
parent 3890fd4cb2
commit bdf55aab19
4 changed files with 99 additions and 21 deletions
+18
View File
@@ -388,3 +388,21 @@ fn max_approvals_limited() {
);
});
}
#[test]
fn remove_already_removed_approval_fails() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&Treasury::account_id(), 101);
assert_ok!(Treasury::propose_spend(Origin::signed(0), 100, 3));
assert_ok!(Treasury::approve_proposal(Origin::root(), 0));
assert_eq!(Treasury::approvals(), vec![0]);
assert_ok!(Treasury::remove_approval(Origin::root(), 0));
assert_eq!(Treasury::approvals(), vec![]);
assert_noop!(
Treasury::remove_approval(Origin::root(), 0),
Error::<Test, _>::ProposalNotApproved
);
});
}