pallet-bounties: allow bounties to never expire#7723
Conversation
prdoc/pr_7723.prdoc
Outdated
| title: '[pallet-bounties] Make BountyUpdatePeriod optional' | ||
| doc: | ||
| - audience: Runtime Dev | ||
| description: Refactored `BountyUpdatePeriod` to be optional and adjusted expiration handling to default to `BlockNumber::MAX` when `None`. |
There was a problem hiding this comment.
this will be included in the release notes. I would explain what this means. this is more like a description of the implementation, it can be read from the code.
also please add PR description
substrate/frame/bounties/src/lib.rs
Outdated
| type BountyDepositPayoutDelay: Get<BlockNumberFor<Self, I>>; | ||
|
|
||
| /// Bounty duration in blocks. | ||
| /// Optional bounty duration in blocks. If `None`, it is considered `BlockNumber::MAX`. |
There was a problem hiding this comment.
it was a poor doc for this parameter, lets give more context. explain behaviour.
".. it is considered BlockNumber::MAX" is description of the implementation. what it means for a user.
prdoc/pr_7723.prdoc
Outdated
| If slashing of curators is necessary, it can be handled through OpenGov. | ||
| This reduces friction in curator management. |
There was a problem hiding this comment.
| If slashing of curators is necessary, it can be handled through OpenGov. | |
| This reduces friction in curator management. |
this is a bit specific to Polkadot, but the rest looks good
substrate/frame/bounties/src/lib.rs
Outdated
| type BountyDepositPayoutDelay: Get<BlockNumberFor<Self, I>>; | ||
|
|
||
| /// Bounty duration in blocks. | ||
| /// Optional bounty duration in blocks. |
There was a problem hiding this comment.
| /// Optional bounty duration in blocks. | |
| /// The period that starts when a curator is approved, during which they must execute or | |
| /// update the bounty via `extend_bounty_expiry`. If missed, the bounty expires, and the | |
| /// curator may be slashed. |
There was a problem hiding this comment.
Thanks for proposing. I think it is too long for the first sentence, given the guide "Strive to make the first sentence succint and short ...". But I will commit
substrate/frame/bounties/src/lib.rs
Outdated
| /// If `None`, bounties stay active indefinitely, removing the need for | ||
| /// `extend_bounty_expiry` and restricting curator slashing to OpenGov. |
There was a problem hiding this comment.
| /// If `None`, bounties stay active indefinitely, removing the need for | |
| /// `extend_bounty_expiry` and restricting curator slashing to OpenGov. | |
| /// If `None`, bounties stay active indefinitely, removing the need for | |
| /// `extend_bounty_expiry`. |
OpenGov part is specific to the runtime e
prdoc/pr_7723.prdoc
Outdated
| Migrating `BountyUpdatePeriod` from `BlockNumber` to `Option<BlockNumber>` where | ||
| if set to (), bounties will no longer expire. |
There was a problem hiding this comment.
set to None, () is a unit type. migration is more meant to guide clients who already using this feature and will face the breaking change. here the migration for them is simple, they need to wrap their value into Some(BountyUpdatePeriod) and that would be lead to exact same behaviour
substrate/frame/bounties/src/lib.rs
Outdated
| T::BountyUpdatePeriod::get() | ||
| .unwrap_or(BlockNumberFor::<T, I>::max_value()), |
There was a problem hiding this comment.
this part repeated few time, you could abstract it into function
|
Review required! Latest push from author must always be reviewed |
|
@muharem I pushed again to apply your feedback. Who do you recommend for a second reviewer? |
|
|
||
| // If `BountyUpdatePeriod` overflows the inactivity timeout the benchmark still executes the slash | ||
| let origin = if Pallet::<T>::treasury_block_number() <= inactivity_timeout { | ||
| T::RejectOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)? |
There was a problem hiding this comment.
it should not be Weightless, even if you have not reject origin, the call is still executable by some caller in some cases or by curator
There was a problem hiding this comment.
it should be curator when now <= inactivity_timeout, only curator in this case can run unassign_curator call if the bounty is active
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
AKJUS
left a comment
There was a problem hiding this comment.
given jasper said pull_request than...
* master: (58 commits) Upgrade link-checker cache to v4 (#7874) Updating readmes (#7950) Cumulus: Remove some old scripts (#7946) pallet-bounties: allow bounties to never expire (#7723) run frame-omni-bencher overhead command in CI for all runtimes in the runtime matrix (#7459) Update README.md for Cumulus (#7930) FRAME: Meta Transaction (#6428) Follow up for: Use the umbrella crate for the parachain template #5993 (#7464) Add an extra_constant to pallet-treasury (#7918) Bump the ci_dependencies group across 1 directory with 4 updates (#7855) remove compromised action (#7934) Fixing token-economics dead link (#5302) [pallet-revive] Fix pallet-revive-fixtures build.rs (#7928) cumulus: fix pov exporter format (#7923) sp-api: Support `mut` in `impl_runtime_apis!` (#7924) Remove clones from block seal function (#7917) [pallet-revive] precompiles 2->9 (#7810) Use non-native token to benchmark xcm on asset hub (#7893) [CI] bump timeout wait for build in zombienet workflows. (#7871) taplo: split long array line to multiline array (#7905) ...
Extend bounty update period to 10 years There have been multiple cases (e.g., [referenda/1588](https://polkadot.subsquare.io/referenda/1588)) where active bounties expired, requiring the community to vote again to reintroduce the same bounty. This PR increases the update period to 10 years to prevent such issues for newly created bounties. Note that the community can still cancel any active bounty through a governance vote. Once [polkadot-sdk#7723](paritytech/polkadot-sdk#7723) is included in an SDK release and adopted in runtime upgrades, we will be able to configure bounties to never expire. --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]>
Description
Fixes polkadot-fellows/runtimes#509
The Bounties expiration and renewal heavily depends on manual interactions through UI. This PR refactors the
update_duecalculation to usesaturating_add, allowing bounties to remain active indefinitely without requiringextend_bounty_expiryand preventing automatic curator slashing for inactivity, which often penalises unnecessarily. Previously, settingBountyUpdatePeriodto a large value, such asBlockNumber::max_value(), could cause an overflow.Integration
Set BountyUpdatePeriod to BlockNumber::max_value()
Review Notes
Modifies how bounty expiry is handled
🔍 Code Diff Summary