mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Bounties use SpendOrigin (#12808)
* Bounties use SpendOrigin * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * tests: increase spend limits Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix benchmarks Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix child-bounties tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * ".git/.scripts/bench-bot.sh" pallet dev pallet_bounties Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -97,7 +97,7 @@ benchmarks_instance_pallet! {
|
|||||||
let (caller, curator, fee, value, reason) = setup_bounty::<T, I>(0, T::MaximumReasonLength::get());
|
let (caller, curator, fee, value, reason) = setup_bounty::<T, I>(0, T::MaximumReasonLength::get());
|
||||||
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
||||||
let bounty_id = BountyCount::<T, I>::get() - 1;
|
let bounty_id = BountyCount::<T, I>::get() - 1;
|
||||||
let approve_origin = T::ApproveOrigin::successful_origin();
|
let approve_origin = T::SpendOrigin::successful_origin();
|
||||||
}: _<T::RuntimeOrigin>(approve_origin, bounty_id)
|
}: _<T::RuntimeOrigin>(approve_origin, bounty_id)
|
||||||
|
|
||||||
propose_curator {
|
propose_curator {
|
||||||
@@ -106,10 +106,10 @@ benchmarks_instance_pallet! {
|
|||||||
let curator_lookup = T::Lookup::unlookup(curator);
|
let curator_lookup = T::Lookup::unlookup(curator);
|
||||||
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
||||||
let bounty_id = BountyCount::<T, I>::get() - 1;
|
let bounty_id = BountyCount::<T, I>::get() - 1;
|
||||||
let approve_origin = T::ApproveOrigin::successful_origin();
|
let approve_origin = T::SpendOrigin::successful_origin();
|
||||||
Bounties::<T, I>::approve_bounty(approve_origin, bounty_id)?;
|
Bounties::<T, I>::approve_bounty(approve_origin, bounty_id)?;
|
||||||
Treasury::<T, I>::on_initialize(T::BlockNumber::zero());
|
Treasury::<T, I>::on_initialize(T::BlockNumber::zero());
|
||||||
let approve_origin = T::ApproveOrigin::successful_origin();
|
let approve_origin = T::SpendOrigin::successful_origin();
|
||||||
}: _<T::RuntimeOrigin>(approve_origin, bounty_id, curator_lookup, fee)
|
}: _<T::RuntimeOrigin>(approve_origin, bounty_id, curator_lookup, fee)
|
||||||
|
|
||||||
// Worst case when curator is inactive and any sender unassigns the curator.
|
// Worst case when curator is inactive and any sender unassigns the curator.
|
||||||
@@ -128,7 +128,7 @@ benchmarks_instance_pallet! {
|
|||||||
let curator_lookup = T::Lookup::unlookup(curator.clone());
|
let curator_lookup = T::Lookup::unlookup(curator.clone());
|
||||||
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
Bounties::<T, I>::propose_bounty(RawOrigin::Signed(caller).into(), value, reason)?;
|
||||||
let bounty_id = BountyCount::<T, I>::get() - 1;
|
let bounty_id = BountyCount::<T, I>::get() - 1;
|
||||||
let approve_origin = T::ApproveOrigin::successful_origin();
|
let approve_origin = T::SpendOrigin::successful_origin();
|
||||||
Bounties::<T, I>::approve_bounty(approve_origin.clone(), bounty_id)?;
|
Bounties::<T, I>::approve_bounty(approve_origin.clone(), bounty_id)?;
|
||||||
Treasury::<T, I>::on_initialize(T::BlockNumber::zero());
|
Treasury::<T, I>::on_initialize(T::BlockNumber::zero());
|
||||||
Bounties::<T, I>::propose_curator(approve_origin, bounty_id, curator_lookup, fee)?;
|
Bounties::<T, I>::propose_curator(approve_origin, bounty_id, curator_lookup, fee)?;
|
||||||
|
|||||||
@@ -357,10 +357,13 @@ pub mod pallet {
|
|||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
#[pallet::compact] bounty_id: BountyIndex,
|
#[pallet::compact] bounty_id: BountyIndex,
|
||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
T::ApproveOrigin::ensure_origin(origin)?;
|
let max_amount = T::SpendOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
||||||
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
|
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
|
||||||
|
ensure!(
|
||||||
|
bounty.value <= max_amount,
|
||||||
|
pallet_treasury::Error::<T, I>::InsufficientPermission
|
||||||
|
);
|
||||||
ensure!(bounty.status == BountyStatus::Proposed, Error::<T, I>::UnexpectedStatus);
|
ensure!(bounty.status == BountyStatus::Proposed, Error::<T, I>::UnexpectedStatus);
|
||||||
|
|
||||||
bounty.status = BountyStatus::Approved;
|
bounty.status = BountyStatus::Approved;
|
||||||
@@ -387,11 +390,15 @@ pub mod pallet {
|
|||||||
curator: AccountIdLookupOf<T>,
|
curator: AccountIdLookupOf<T>,
|
||||||
#[pallet::compact] fee: BalanceOf<T, I>,
|
#[pallet::compact] fee: BalanceOf<T, I>,
|
||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
T::ApproveOrigin::ensure_origin(origin)?;
|
let max_amount = T::SpendOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
let curator = T::Lookup::lookup(curator)?;
|
let curator = T::Lookup::lookup(curator)?;
|
||||||
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
Bounties::<T, I>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
||||||
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
|
let mut bounty = maybe_bounty.as_mut().ok_or(Error::<T, I>::InvalidIndex)?;
|
||||||
|
ensure!(
|
||||||
|
bounty.value <= max_amount,
|
||||||
|
pallet_treasury::Error::<T, I>::InsufficientPermission
|
||||||
|
);
|
||||||
match bounty.status {
|
match bounty.status {
|
||||||
BountyStatus::Funded => {},
|
BountyStatus::Funded => {},
|
||||||
_ => return Err(Error::<T, I>::UnexpectedStatus.into()),
|
_ => return Err(Error::<T, I>::UnexpectedStatus.into()),
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ parameter_types! {
|
|||||||
pub static Burn: Permill = Permill::from_percent(50);
|
pub static Burn: Permill = Permill::from_percent(50);
|
||||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||||
pub const TreasuryPalletId2: PalletId = PalletId(*b"py/trsr2");
|
pub const TreasuryPalletId2: PalletId = PalletId(*b"py/trsr2");
|
||||||
|
pub static SpendLimit: Balance = u64::MAX;
|
||||||
|
pub static SpendLimit1: Balance = u64::MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_treasury::Config for Test {
|
impl pallet_treasury::Config for Test {
|
||||||
@@ -124,7 +126,7 @@ impl pallet_treasury::Config for Test {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type SpendFunds = Bounties;
|
type SpendFunds = Bounties;
|
||||||
type MaxApprovals = ConstU32<100>;
|
type MaxApprovals = ConstU32<100>;
|
||||||
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u64>;
|
type SpendOrigin = frame_system::EnsureRootWithSuccess<Self::AccountId, SpendLimit>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_treasury::Config<Instance1> for Test {
|
impl pallet_treasury::Config<Instance1> for Test {
|
||||||
@@ -143,7 +145,7 @@ impl pallet_treasury::Config<Instance1> for Test {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type SpendFunds = Bounties1;
|
type SpendFunds = Bounties1;
|
||||||
type MaxApprovals = ConstU32<100>;
|
type MaxApprovals = ConstU32<100>;
|
||||||
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u64>;
|
type SpendOrigin = frame_system::EnsureRootWithSuccess<Self::AccountId, SpendLimit1>;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -185,6 +187,7 @@ impl Config<Instance1> for Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TreasuryError = pallet_treasury::Error<Test>;
|
type TreasuryError = pallet_treasury::Error<Test>;
|
||||||
|
type TreasuryError1 = pallet_treasury::Error<Test, Instance1>;
|
||||||
|
|
||||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||||
@@ -1136,6 +1139,8 @@ fn accept_curator_handles_different_deposit_calculations() {
|
|||||||
System::set_block_number(1);
|
System::set_block_number(1);
|
||||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||||
Balances::make_free_balance_be(&user, 100);
|
Balances::make_free_balance_be(&user, 100);
|
||||||
|
// Allow for a larger spend limit:
|
||||||
|
SpendLimit::set(value);
|
||||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), value, b"12345".to_vec()));
|
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), value, b"12345".to_vec()));
|
||||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), bounty_index));
|
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), bounty_index));
|
||||||
|
|
||||||
@@ -1182,6 +1187,8 @@ fn accept_curator_handles_different_deposit_calculations() {
|
|||||||
Balances::make_free_balance_be(&user, starting_balance);
|
Balances::make_free_balance_be(&user, starting_balance);
|
||||||
Balances::make_free_balance_be(&0, starting_balance);
|
Balances::make_free_balance_be(&0, starting_balance);
|
||||||
|
|
||||||
|
// Allow for a larger spend limit:
|
||||||
|
SpendLimit::set(value);
|
||||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), value, b"12345".to_vec()));
|
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), value, b"12345".to_vec()));
|
||||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), bounty_index));
|
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), bounty_index));
|
||||||
|
|
||||||
@@ -1209,16 +1216,98 @@ fn approve_bounty_works_second_instance() {
|
|||||||
assert_eq!(Balances::free_balance(&Treasury::account_id()), 101);
|
assert_eq!(Balances::free_balance(&Treasury::account_id()), 101);
|
||||||
assert_eq!(Balances::free_balance(&Treasury1::account_id()), 201);
|
assert_eq!(Balances::free_balance(&Treasury1::account_id()), 201);
|
||||||
|
|
||||||
assert_ok!(Bounties1::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
assert_ok!(Bounties1::propose_bounty(RuntimeOrigin::signed(0), 10, b"12345".to_vec()));
|
||||||
assert_ok!(Bounties1::approve_bounty(RuntimeOrigin::root(), 0));
|
assert_ok!(Bounties1::approve_bounty(RuntimeOrigin::root(), 0));
|
||||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||||
<Treasury1 as OnInitialize<u64>>::on_initialize(2);
|
<Treasury1 as OnInitialize<u64>>::on_initialize(2);
|
||||||
|
|
||||||
// Bounties 1 is funded... but from where?
|
// Bounties 1 is funded... but from where?
|
||||||
assert_eq!(Balances::free_balance(Bounties1::bounty_account_id(0)), 50);
|
assert_eq!(Balances::free_balance(Bounties1::bounty_account_id(0)), 10);
|
||||||
// Treasury 1 unchanged
|
// Treasury 1 unchanged
|
||||||
assert_eq!(Balances::free_balance(&Treasury::account_id()), 101);
|
assert_eq!(Balances::free_balance(&Treasury::account_id()), 101);
|
||||||
// Treasury 2 has funds removed
|
// Treasury 2 has funds removed
|
||||||
assert_eq!(Balances::free_balance(&Treasury1::account_id()), 201 - 50);
|
assert_eq!(Balances::free_balance(&Treasury1::account_id()), 201 - 10);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn approve_bounty_insufficient_spend_limit_errors() {
|
||||||
|
new_test_ext().execute_with(|| {
|
||||||
|
System::set_block_number(1);
|
||||||
|
|
||||||
|
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||||
|
assert_eq!(Treasury::pot(), 100);
|
||||||
|
|
||||||
|
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 51, b"123".to_vec()));
|
||||||
|
// 51 will not work since the limit is 50.
|
||||||
|
SpendLimit::set(50);
|
||||||
|
assert_noop!(
|
||||||
|
Bounties::approve_bounty(RuntimeOrigin::root(), 0),
|
||||||
|
TreasuryError::InsufficientPermission
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn approve_bounty_instance1_insufficient_spend_limit_errors() {
|
||||||
|
new_test_ext().execute_with(|| {
|
||||||
|
System::set_block_number(1);
|
||||||
|
|
||||||
|
Balances::make_free_balance_be(&Treasury1::account_id(), 101);
|
||||||
|
assert_eq!(Treasury1::pot(), 100);
|
||||||
|
|
||||||
|
assert_ok!(Bounties1::propose_bounty(RuntimeOrigin::signed(0), 51, b"123".to_vec()));
|
||||||
|
// 51 will not work since the limit is 50.
|
||||||
|
SpendLimit1::set(50);
|
||||||
|
assert_noop!(
|
||||||
|
Bounties1::approve_bounty(RuntimeOrigin::root(), 0),
|
||||||
|
TreasuryError1::InsufficientPermission
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn propose_curator_insufficient_spend_limit_errors() {
|
||||||
|
new_test_ext().execute_with(|| {
|
||||||
|
System::set_block_number(1);
|
||||||
|
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||||
|
|
||||||
|
// Temporarily set a larger spend limit;
|
||||||
|
SpendLimit::set(51);
|
||||||
|
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 51, b"12345".to_vec()));
|
||||||
|
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||||
|
|
||||||
|
System::set_block_number(2);
|
||||||
|
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||||
|
|
||||||
|
SpendLimit::set(50);
|
||||||
|
// 51 will not work since the limit is 50.
|
||||||
|
assert_noop!(
|
||||||
|
Bounties::propose_curator(RuntimeOrigin::root(), 0, 0, 0),
|
||||||
|
TreasuryError::InsufficientPermission
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn propose_curator_instance1_insufficient_spend_limit_errors() {
|
||||||
|
new_test_ext().execute_with(|| {
|
||||||
|
System::set_block_number(1);
|
||||||
|
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||||
|
|
||||||
|
// Temporarily set a larger spend limit;
|
||||||
|
SpendLimit1::set(11);
|
||||||
|
assert_ok!(Bounties1::propose_bounty(RuntimeOrigin::signed(0), 11, b"12345".to_vec()));
|
||||||
|
assert_ok!(Bounties1::approve_bounty(RuntimeOrigin::root(), 0));
|
||||||
|
|
||||||
|
System::set_block_number(2);
|
||||||
|
<Treasury1 as OnInitialize<u64>>::on_initialize(2);
|
||||||
|
|
||||||
|
SpendLimit1::set(10);
|
||||||
|
// 11 will not work since the limit is 10.
|
||||||
|
assert_noop!(
|
||||||
|
Bounties1::propose_curator(RuntimeOrigin::root(), 0, 0, 0),
|
||||||
|
TreasuryError1::InsufficientPermission
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,24 +18,25 @@
|
|||||||
//! Autogenerated weights for pallet_bounties
|
//! Autogenerated weights for pallet_bounties
|
||||||
//!
|
//!
|
||||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
//! DATE: 2022-11-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
//! DATE: 2022-11-30, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||||
|
|
||||||
// Executed Command:
|
// Executed Command:
|
||||||
// ./target/production/substrate
|
// /home/benchbot/cargo_target_dir/production/substrate
|
||||||
// benchmark
|
// benchmark
|
||||||
// pallet
|
// pallet
|
||||||
// --chain=dev
|
|
||||||
// --steps=50
|
// --steps=50
|
||||||
// --repeat=20
|
// --repeat=20
|
||||||
// --pallet=pallet_bounties
|
|
||||||
// --extrinsic=*
|
// --extrinsic=*
|
||||||
// --execution=wasm
|
// --execution=wasm
|
||||||
// --wasm-execution=compiled
|
// --wasm-execution=compiled
|
||||||
// --heap-pages=4096
|
// --heap-pages=4096
|
||||||
// --output=./frame/bounties/src/weights.rs
|
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
|
||||||
|
// --pallet=pallet_bounties
|
||||||
|
// --chain=dev
|
||||||
// --header=./HEADER-APACHE2
|
// --header=./HEADER-APACHE2
|
||||||
|
// --output=./frame/bounties/src/weights.rs
|
||||||
// --template=./.maintain/frame-weight-template.hbs
|
// --template=./.maintain/frame-weight-template.hbs
|
||||||
|
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
@@ -69,102 +70,102 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
|||||||
// Storage: Bounties Bounties (r:0 w:1)
|
// Storage: Bounties Bounties (r:0 w:1)
|
||||||
/// The range of component `d` is `[0, 300]`.
|
/// The range of component `d` is `[0, 300]`.
|
||||||
fn propose_bounty(d: u32, ) -> Weight {
|
fn propose_bounty(d: u32, ) -> Weight {
|
||||||
// Minimum execution time: 33_514 nanoseconds.
|
// Minimum execution time: 33_366 nanoseconds.
|
||||||
Weight::from_ref_time(34_906_466 as u64)
|
Weight::from_ref_time(34_444_773)
|
||||||
// Standard Error: 226
|
// Standard Error: 1_161
|
||||||
.saturating_add(Weight::from_ref_time(2_241 as u64).saturating_mul(d as u64))
|
.saturating_add(Weight::from_ref_time(4_723).saturating_mul(d.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: Bounties BountyApprovals (r:1 w:1)
|
// Storage: Bounties BountyApprovals (r:1 w:1)
|
||||||
fn approve_bounty() -> Weight {
|
fn approve_bounty() -> Weight {
|
||||||
// Minimum execution time: 14_129 nanoseconds.
|
// Minimum execution time: 14_478 nanoseconds.
|
||||||
Weight::from_ref_time(14_424_000 as u64)
|
Weight::from_ref_time(14_763_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
fn propose_curator() -> Weight {
|
fn propose_curator() -> Weight {
|
||||||
// Minimum execution time: 13_675 nanoseconds.
|
// Minimum execution time: 13_376 nanoseconds.
|
||||||
Weight::from_ref_time(13_964_000 as u64)
|
Weight::from_ref_time(13_705_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
fn unassign_curator() -> Weight {
|
fn unassign_curator() -> Weight {
|
||||||
// Minimum execution time: 38_926 nanoseconds.
|
// Minimum execution time: 38_072 nanoseconds.
|
||||||
Weight::from_ref_time(40_183_000 as u64)
|
Weight::from_ref_time(38_676_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
fn accept_curator() -> Weight {
|
fn accept_curator() -> Weight {
|
||||||
// Minimum execution time: 33_774 nanoseconds.
|
// Minimum execution time: 33_207 nanoseconds.
|
||||||
Weight::from_ref_time(34_295_000 as u64)
|
Weight::from_ref_time(34_415_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(2 as u64))
|
.saturating_add(T::DbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
fn award_bounty() -> Weight {
|
fn award_bounty() -> Weight {
|
||||||
// Minimum execution time: 28_558 nanoseconds.
|
// Minimum execution time: 28_033 nanoseconds.
|
||||||
Weight::from_ref_time(29_293_000 as u64)
|
Weight::from_ref_time(28_343_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(2 as u64))
|
.saturating_add(T::DbWeight::get().reads(2))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:3 w:3)
|
// Storage: System Account (r:3 w:3)
|
||||||
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
|
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn claim_bounty() -> Weight {
|
fn claim_bounty() -> Weight {
|
||||||
// Minimum execution time: 77_042 nanoseconds.
|
// Minimum execution time: 75_855 nanoseconds.
|
||||||
Weight::from_ref_time(77_730_000 as u64)
|
Weight::from_ref_time(76_318_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(5 as u64))
|
.saturating_add(T::DbWeight::get().reads(5))
|
||||||
.saturating_add(T::DbWeight::get().writes(6 as u64))
|
.saturating_add(T::DbWeight::get().writes(6))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn close_bounty_proposed() -> Weight {
|
fn close_bounty_proposed() -> Weight {
|
||||||
// Minimum execution time: 43_632 nanoseconds.
|
// Minimum execution time: 41_955 nanoseconds.
|
||||||
Weight::from_ref_time(44_196_000 as u64)
|
Weight::from_ref_time(42_733_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(3 as u64))
|
.saturating_add(T::DbWeight::get().reads(3))
|
||||||
.saturating_add(T::DbWeight::get().writes(3 as u64))
|
.saturating_add(T::DbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
// Storage: System Account (r:2 w:2)
|
// Storage: System Account (r:2 w:2)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn close_bounty_active() -> Weight {
|
fn close_bounty_active() -> Weight {
|
||||||
// Minimum execution time: 59_519 nanoseconds.
|
// Minimum execution time: 58_267 nanoseconds.
|
||||||
Weight::from_ref_time(59_967_000 as u64)
|
Weight::from_ref_time(59_604_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(4 as u64))
|
.saturating_add(T::DbWeight::get().reads(4))
|
||||||
.saturating_add(T::DbWeight::get().writes(4 as u64))
|
.saturating_add(T::DbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
fn extend_bounty_expiry() -> Weight {
|
fn extend_bounty_expiry() -> Weight {
|
||||||
// Minimum execution time: 25_263 nanoseconds.
|
// Minimum execution time: 24_893 nanoseconds.
|
||||||
Weight::from_ref_time(25_788_000 as u64)
|
Weight::from_ref_time(25_299_000)
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties BountyApprovals (r:1 w:1)
|
// Storage: Bounties BountyApprovals (r:1 w:1)
|
||||||
// Storage: Bounties Bounties (r:2 w:2)
|
// Storage: Bounties Bounties (r:2 w:2)
|
||||||
// Storage: System Account (r:4 w:4)
|
// Storage: System Account (r:4 w:4)
|
||||||
/// The range of component `b` is `[0, 100]`.
|
/// The range of component `b` is `[0, 100]`.
|
||||||
fn spend_funds(b: u32, ) -> Weight {
|
fn spend_funds(b: u32, ) -> Weight {
|
||||||
// Minimum execution time: 8_953 nanoseconds.
|
// Minimum execution time: 8_846 nanoseconds.
|
||||||
Weight::from_ref_time(23_242_227 as u64)
|
Weight::from_ref_time(20_166_004)
|
||||||
// Standard Error: 13_187
|
// Standard Error: 28_485
|
||||||
.saturating_add(Weight::from_ref_time(26_727_999 as u64).saturating_mul(b as u64))
|
.saturating_add(Weight::from_ref_time(26_712_253).saturating_mul(b.into()))
|
||||||
.saturating_add(T::DbWeight::get().reads(1 as u64))
|
.saturating_add(T::DbWeight::get().reads(1))
|
||||||
.saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(b as u64)))
|
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into())))
|
||||||
.saturating_add(T::DbWeight::get().writes(1 as u64))
|
.saturating_add(T::DbWeight::get().writes(1))
|
||||||
.saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(b as u64)))
|
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,101 +177,101 @@ impl WeightInfo for () {
|
|||||||
// Storage: Bounties Bounties (r:0 w:1)
|
// Storage: Bounties Bounties (r:0 w:1)
|
||||||
/// The range of component `d` is `[0, 300]`.
|
/// The range of component `d` is `[0, 300]`.
|
||||||
fn propose_bounty(d: u32, ) -> Weight {
|
fn propose_bounty(d: u32, ) -> Weight {
|
||||||
// Minimum execution time: 33_514 nanoseconds.
|
// Minimum execution time: 33_366 nanoseconds.
|
||||||
Weight::from_ref_time(34_906_466 as u64)
|
Weight::from_ref_time(34_444_773)
|
||||||
// Standard Error: 226
|
// Standard Error: 1_161
|
||||||
.saturating_add(Weight::from_ref_time(2_241 as u64).saturating_mul(d as u64))
|
.saturating_add(Weight::from_ref_time(4_723).saturating_mul(d.into()))
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
.saturating_add(RocksDbWeight::get().reads(2))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
.saturating_add(RocksDbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: Bounties BountyApprovals (r:1 w:1)
|
// Storage: Bounties BountyApprovals (r:1 w:1)
|
||||||
fn approve_bounty() -> Weight {
|
fn approve_bounty() -> Weight {
|
||||||
// Minimum execution time: 14_129 nanoseconds.
|
// Minimum execution time: 14_478 nanoseconds.
|
||||||
Weight::from_ref_time(14_424_000 as u64)
|
Weight::from_ref_time(14_763_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
.saturating_add(RocksDbWeight::get().reads(2))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
.saturating_add(RocksDbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
fn propose_curator() -> Weight {
|
fn propose_curator() -> Weight {
|
||||||
// Minimum execution time: 13_675 nanoseconds.
|
// Minimum execution time: 13_376 nanoseconds.
|
||||||
Weight::from_ref_time(13_964_000 as u64)
|
Weight::from_ref_time(13_705_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
fn unassign_curator() -> Weight {
|
fn unassign_curator() -> Weight {
|
||||||
// Minimum execution time: 38_926 nanoseconds.
|
// Minimum execution time: 38_072 nanoseconds.
|
||||||
Weight::from_ref_time(40_183_000 as u64)
|
Weight::from_ref_time(38_676_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
.saturating_add(RocksDbWeight::get().reads(2))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
.saturating_add(RocksDbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
fn accept_curator() -> Weight {
|
fn accept_curator() -> Weight {
|
||||||
// Minimum execution time: 33_774 nanoseconds.
|
// Minimum execution time: 33_207 nanoseconds.
|
||||||
Weight::from_ref_time(34_295_000 as u64)
|
Weight::from_ref_time(34_415_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
.saturating_add(RocksDbWeight::get().reads(2))
|
||||||
.saturating_add(RocksDbWeight::get().writes(2 as u64))
|
.saturating_add(RocksDbWeight::get().writes(2))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
fn award_bounty() -> Weight {
|
fn award_bounty() -> Weight {
|
||||||
// Minimum execution time: 28_558 nanoseconds.
|
// Minimum execution time: 28_033 nanoseconds.
|
||||||
Weight::from_ref_time(29_293_000 as u64)
|
Weight::from_ref_time(28_343_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(2 as u64))
|
.saturating_add(RocksDbWeight::get().reads(2))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: System Account (r:3 w:3)
|
// Storage: System Account (r:3 w:3)
|
||||||
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
|
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn claim_bounty() -> Weight {
|
fn claim_bounty() -> Weight {
|
||||||
// Minimum execution time: 77_042 nanoseconds.
|
// Minimum execution time: 75_855 nanoseconds.
|
||||||
Weight::from_ref_time(77_730_000 as u64)
|
Weight::from_ref_time(76_318_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(5 as u64))
|
.saturating_add(RocksDbWeight::get().reads(5))
|
||||||
.saturating_add(RocksDbWeight::get().writes(6 as u64))
|
.saturating_add(RocksDbWeight::get().writes(6))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
// Storage: System Account (r:1 w:1)
|
// Storage: System Account (r:1 w:1)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn close_bounty_proposed() -> Weight {
|
fn close_bounty_proposed() -> Weight {
|
||||||
// Minimum execution time: 43_632 nanoseconds.
|
// Minimum execution time: 41_955 nanoseconds.
|
||||||
Weight::from_ref_time(44_196_000 as u64)
|
Weight::from_ref_time(42_733_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(3 as u64))
|
.saturating_add(RocksDbWeight::get().reads(3))
|
||||||
.saturating_add(RocksDbWeight::get().writes(3 as u64))
|
.saturating_add(RocksDbWeight::get().writes(3))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
|
||||||
// Storage: System Account (r:2 w:2)
|
// Storage: System Account (r:2 w:2)
|
||||||
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
// Storage: Bounties BountyDescriptions (r:0 w:1)
|
||||||
fn close_bounty_active() -> Weight {
|
fn close_bounty_active() -> Weight {
|
||||||
// Minimum execution time: 59_519 nanoseconds.
|
// Minimum execution time: 58_267 nanoseconds.
|
||||||
Weight::from_ref_time(59_967_000 as u64)
|
Weight::from_ref_time(59_604_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(4 as u64))
|
.saturating_add(RocksDbWeight::get().reads(4))
|
||||||
.saturating_add(RocksDbWeight::get().writes(4 as u64))
|
.saturating_add(RocksDbWeight::get().writes(4))
|
||||||
}
|
}
|
||||||
// Storage: Bounties Bounties (r:1 w:1)
|
// Storage: Bounties Bounties (r:1 w:1)
|
||||||
fn extend_bounty_expiry() -> Weight {
|
fn extend_bounty_expiry() -> Weight {
|
||||||
// Minimum execution time: 25_263 nanoseconds.
|
// Minimum execution time: 24_893 nanoseconds.
|
||||||
Weight::from_ref_time(25_788_000 as u64)
|
Weight::from_ref_time(25_299_000)
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1))
|
||||||
}
|
}
|
||||||
// Storage: Bounties BountyApprovals (r:1 w:1)
|
// Storage: Bounties BountyApprovals (r:1 w:1)
|
||||||
// Storage: Bounties Bounties (r:2 w:2)
|
// Storage: Bounties Bounties (r:2 w:2)
|
||||||
// Storage: System Account (r:4 w:4)
|
// Storage: System Account (r:4 w:4)
|
||||||
/// The range of component `b` is `[0, 100]`.
|
/// The range of component `b` is `[0, 100]`.
|
||||||
fn spend_funds(b: u32, ) -> Weight {
|
fn spend_funds(b: u32, ) -> Weight {
|
||||||
// Minimum execution time: 8_953 nanoseconds.
|
// Minimum execution time: 8_846 nanoseconds.
|
||||||
Weight::from_ref_time(23_242_227 as u64)
|
Weight::from_ref_time(20_166_004)
|
||||||
// Standard Error: 13_187
|
// Standard Error: 28_485
|
||||||
.saturating_add(Weight::from_ref_time(26_727_999 as u64).saturating_mul(b as u64))
|
.saturating_add(Weight::from_ref_time(26_712_253).saturating_mul(b.into()))
|
||||||
.saturating_add(RocksDbWeight::get().reads(1 as u64))
|
.saturating_add(RocksDbWeight::get().reads(1))
|
||||||
.saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(b as u64)))
|
.saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into())))
|
||||||
.saturating_add(RocksDbWeight::get().writes(1 as u64))
|
.saturating_add(RocksDbWeight::get().writes(1))
|
||||||
.saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(b as u64)))
|
.saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ parameter_types! {
|
|||||||
pub const ProposalBond: Permill = Permill::from_percent(5);
|
pub const ProposalBond: Permill = Permill::from_percent(5);
|
||||||
pub const Burn: Permill = Permill::from_percent(50);
|
pub const Burn: Permill = Permill::from_percent(50);
|
||||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||||
|
pub const SpendLimit: Balance = u64::MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_treasury::Config for Test {
|
impl pallet_treasury::Config for Test {
|
||||||
@@ -126,7 +127,7 @@ impl pallet_treasury::Config for Test {
|
|||||||
type WeightInfo = ();
|
type WeightInfo = ();
|
||||||
type SpendFunds = Bounties;
|
type SpendFunds = Bounties;
|
||||||
type MaxApprovals = ConstU32<100>;
|
type MaxApprovals = ConstU32<100>;
|
||||||
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u64>;
|
type SpendOrigin = frame_system::EnsureRootWithSuccess<Self::AccountId, SpendLimit>;
|
||||||
}
|
}
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
// This will be 50% of the bounty fee.
|
// This will be 50% of the bounty fee.
|
||||||
|
|||||||
Reference in New Issue
Block a user