Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pallet-bounties: extends update_due infinitly if BountiesUpdatePeriod… #7723

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

BigTava
Copy link

@BigTava BigTava commented Feb 26, 2025

… is None

Description

Fixes polkadot-fellows/runtimes#509

The Bounties expiration and renewal heavily depends on manual interactions through UI. This PR refactors the duration of the bounty to be an optional configuration constant. If set to None, bounties remain active indefinitely, removing the need for callingextend_bounty_expiry and preventing automatic curator slashing for inactivity, which often penalises unnecessarily.

Integration

Remove BountyUpdatePeriod

Review Notes

Modifies how bounty expiry is handled

🔍 Code Diff Summary
- #[pallet::constant]
- type BountyUpdatePeriod: Get<BlockNumberFor<Self, I>>;
+ #[pallet::constant]
+ type BountyUpdatePeriod: Get<Option<BlockNumberFor<Self, I>>>;

- *update_due = (Self::treasury_block_number() + T::BountyUpdatePeriod::get()).max(*update_due);
+ *update_due = Self::treasury_block_number().saturating_add(
+     T::BountyUpdatePeriod::get().unwrap_or(BlockNumberFor::<T, I>::MAX)
+ ); 

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: ask maintainers to put the right label on your PR.
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@BigTava BigTava requested a review from a team as a code owner February 26, 2025 10:41
@BigTava BigTava added the T2-pallets This PR/Issue is related to a particular pallet. label Feb 26, 2025
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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

@@ -221,9 +224,9 @@ pub mod pallet {
#[pallet::constant]
type BountyDepositPayoutDelay: Get<BlockNumberFor<Self, I>>;

/// Bounty duration in blocks.
/// Optional bounty duration in blocks. If `None`, it is considered `BlockNumber::MAX`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/13568501540
Failed job name: test-linux-stable-no-try-runtime

@paritytech-review-bot paritytech-review-bot bot requested a review from a team February 27, 2025 15:48
Comment on lines +8 to +9
If slashing of curators is necessary, it can be handled through OpenGov.
This reduces friction in curator management.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@@ -221,9 +224,12 @@ pub mod pallet {
#[pallet::constant]
type BountyDepositPayoutDelay: Get<BlockNumberFor<Self, I>>;

/// Bounty duration in blocks.
/// Optional bounty duration in blocks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 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.

Comment on lines +229 to +230
/// If `None`, bounties stay active indefinitely, removing the need for
/// `extend_bounty_expiry` and restricting curator slashing to OpenGov.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Bounty Expiry from Bounties Pallet
2 participants