Allow council to slash treasury tip (#7753)

* wk2051 | D4 |Allow council to slash treasury tip | p1

* Update frame/tips/src/lib.rs

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

* wk2051 | D5 |Allow council to slash treasury tip | p2

* wk2051 | D5 |Allow council to slash treasury tip | p3

* wk2051 | D5 |Allow council to slash treasury tip | p4

* wk2051 | D5 |Allow council to slash treasury tip | p5

* random change

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

* fix typo

* Update frame/tips/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/tips/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/tips/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/tips/src/lib.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/tips/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* wk2052 | D1 | Allow council to slash treasury tip | p6

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
RK
2020-12-30 00:07:19 +05:30
committed by GitHub
parent 8c795accc8
commit acf9d2145d
7 changed files with 133 additions and 63 deletions
+10 -10
View File
@@ -77,7 +77,7 @@ fn create_bounty<T: Config>() -> Result<(
Ok((curator_lookup, bounty_id))
}
fn setup_pod_account<T: Config>() {
fn setup_pot_account<T: Config>() {
let pot_account = Bounties::<T>::account_id();
let value = T::Currency::minimum_balance().saturating_mul(1_000_000_000u32.into());
let _ = T::Currency::make_free_balance_be(&pot_account, value);
@@ -109,7 +109,7 @@ benchmarks! {
}: _(RawOrigin::Root, bounty_id)
propose_curator {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (caller, curator, fee, value, reason) = setup_bounty::<T>(0, MAX_BYTES);
let curator_lookup = T::Lookup::unlookup(curator.clone());
Bounties::<T>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
@@ -120,7 +120,7 @@ benchmarks! {
// Worst case when curator is inactive and any sender unassigns the curator.
unassign_curator {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
Bounties::<T>::on_initialize(T::BlockNumber::zero());
let bounty_id = BountyCount::get() - 1;
@@ -129,7 +129,7 @@ benchmarks! {
}: _(RawOrigin::Signed(caller), bounty_id)
accept_curator {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (caller, curator, fee, value, reason) = setup_bounty::<T>(0, MAX_BYTES);
let curator_lookup = T::Lookup::unlookup(curator.clone());
Bounties::<T>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
@@ -140,7 +140,7 @@ benchmarks! {
}: _(RawOrigin::Signed(curator), bounty_id)
award_bounty {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
Bounties::<T>::on_initialize(T::BlockNumber::zero());
@@ -150,7 +150,7 @@ benchmarks! {
}: _(RawOrigin::Signed(curator), bounty_id, beneficiary)
claim_bounty {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
Bounties::<T>::on_initialize(T::BlockNumber::zero());
@@ -170,14 +170,14 @@ benchmarks! {
}
close_bounty_proposed {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (caller, curator, fee, value, reason) = setup_bounty::<T>(0, 0);
Bounties::<T>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
let bounty_id = BountyCount::get() - 1;
}: close_bounty(RawOrigin::Root, bounty_id)
close_bounty_active {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
Bounties::<T>::on_initialize(T::BlockNumber::zero());
let bounty_id = BountyCount::get() - 1;
@@ -187,7 +187,7 @@ benchmarks! {
}
extend_bounty_expiry {
setup_pod_account::<T>();
setup_pot_account::<T>();
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
Bounties::<T>::on_initialize(T::BlockNumber::zero());
@@ -200,7 +200,7 @@ benchmarks! {
spend_funds {
let b in 1 .. 100;
setup_pod_account::<T>();
setup_pot_account::<T>();
create_approved_bounties::<T>(b)?;
let mut budget_remaining = BalanceOf::<T>::max_value();