mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Add child-bounties pallet. (#10309)
* Extract child-bounties as a separate pallet. * Initial tests added. * More tests. * Tests complete. Fixed curator fee issue. * Fixed comments. * Added benchmarks for child-bounties pallet. * Added weights. * Fixed formatting. * Fixed comments. * Re-run benchmarks for bounties pallet. * Make cargo fmt happy again * add max encoded len * use event structs * fmt * fix compile * Addressed review comments. * Use config type instead of const in benchmarking. * Addressed more review comments. * Use ensure_can_withdraw instead of just checking min balance. * fmt. * Introduce ChildBountyCuratorDepositBase to avoid zero curator deposits for child bounties. * Fix unassign curator logic for child-bounties. * Added more tests for unassign curator. * Reduce bounty description max length in node runtime. * Updated weights for child bounties pallet. * reduce indentation of unassign_curator * more indentation reduction * deduplicate slashing arms * reintroduce ensure check * add assertion to check that bad unassign origin fails * formatting * Updated comments. Co-authored-by: Ricardo Rius <ricardo@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -59,6 +59,7 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, path = "../../.
|
||||
pallet-bags-list = { version = "4.0.0-dev", default-features = false, path = "../../../frame/bags-list" }
|
||||
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../../frame/balances" }
|
||||
pallet-bounties = { version = "4.0.0-dev", default-features = false, path = "../../../frame/bounties" }
|
||||
pallet-child-bounties = { version = "4.0.0-dev", default-features = false, path = "../../../frame/child-bounties" }
|
||||
pallet-collective = { version = "4.0.0-dev", default-features = false, path = "../../../frame/collective" }
|
||||
pallet-contracts = { version = "4.0.0-dev", default-features = false, path = "../../../frame/contracts" }
|
||||
pallet-contracts-primitives = { version = "4.0.0-dev", default-features = false, path = "../../../frame/contracts/common/" }
|
||||
@@ -173,7 +174,8 @@ std = [
|
||||
"log/std",
|
||||
"frame-try-runtime/std",
|
||||
"sp-npos-elections/std",
|
||||
"sp-io/std"
|
||||
"sp-io/std",
|
||||
"pallet-child-bounties/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
@@ -186,6 +188,7 @@ runtime-benchmarks = [
|
||||
"pallet-bags-list/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-bounties/runtime-benchmarks",
|
||||
"pallet-child-bounties/runtime-benchmarks",
|
||||
"pallet-collective/runtime-benchmarks",
|
||||
"pallet-contracts/runtime-benchmarks",
|
||||
"pallet-democracy/runtime-benchmarks",
|
||||
@@ -225,6 +228,7 @@ try-runtime = [
|
||||
"pallet-babe/try-runtime",
|
||||
"pallet-balances/try-runtime",
|
||||
"pallet-bounties/try-runtime",
|
||||
"pallet-child-bounties/try-runtime",
|
||||
"pallet-collective/try-runtime",
|
||||
"pallet-contracts/try-runtime",
|
||||
"pallet-democracy/try-runtime",
|
||||
|
||||
@@ -844,10 +844,13 @@ parameter_types! {
|
||||
pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;
|
||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||
pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;
|
||||
pub const MaximumReasonLength: u32 = 16384;
|
||||
pub const MaximumReasonLength: u32 = 300;
|
||||
pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
|
||||
pub const BountyValueMinimum: Balance = 5 * DOLLARS;
|
||||
pub const MaxApprovals: u32 = 100;
|
||||
pub const MaxActiveChildBountyCount: u32 = 5;
|
||||
pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS;
|
||||
pub const ChildBountyCuratorDepositBase: Permill = Permill::from_percent(10);
|
||||
}
|
||||
|
||||
impl pallet_treasury::Config for Runtime {
|
||||
@@ -883,6 +886,15 @@ impl pallet_bounties::Config for Runtime {
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type MaximumReasonLength = MaximumReasonLength;
|
||||
type WeightInfo = pallet_bounties::weights::SubstrateWeight<Runtime>;
|
||||
type ChildBountyManager = ChildBounties;
|
||||
}
|
||||
|
||||
impl pallet_child_bounties::Config for Runtime {
|
||||
type Event = Event;
|
||||
type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
|
||||
type ChildBountyValueMinimum = ChildBountyValueMinimum;
|
||||
type ChildBountyCuratorDepositBase = ChildBountyCuratorDepositBase;
|
||||
type WeightInfo = pallet_child_bounties::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_tips::Config for Runtime {
|
||||
@@ -1302,6 +1314,7 @@ construct_runtime!(
|
||||
Uniques: pallet_uniques,
|
||||
TransactionStorage: pallet_transaction_storage,
|
||||
BagsList: pallet_bags_list,
|
||||
ChildBounties: pallet_child_bounties,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1652,6 +1665,7 @@ impl_runtime_apis! {
|
||||
list_benchmark!(list, extra, pallet_bags_list, BagsList);
|
||||
list_benchmark!(list, extra, pallet_balances, Balances);
|
||||
list_benchmark!(list, extra, pallet_bounties, Bounties);
|
||||
list_benchmark!(list, extra, pallet_child_bounties, ChildBounties);
|
||||
list_benchmark!(list, extra, pallet_collective, Council);
|
||||
list_benchmark!(list, extra, pallet_contracts, Contracts);
|
||||
list_benchmark!(list, extra, pallet_democracy, Democracy);
|
||||
@@ -1729,6 +1743,7 @@ impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
||||
add_benchmark!(params, batches, pallet_bags_list, BagsList);
|
||||
add_benchmark!(params, batches, pallet_bounties, Bounties);
|
||||
add_benchmark!(params, batches, pallet_child_bounties, ChildBounties);
|
||||
add_benchmark!(params, batches, pallet_collective, Council);
|
||||
add_benchmark!(params, batches, pallet_contracts, Contracts);
|
||||
add_benchmark!(params, batches, pallet_democracy, Democracy);
|
||||
|
||||
Reference in New Issue
Block a user