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

Withdraw funds from bounty. #2160

Merged
merged 20 commits into from
Feb 17, 2021

Conversation

shamil-gadelshin
Copy link
Contributor

@shamil-gadelshin shamil-gadelshin commented Feb 10, 2021

Changes

  • added withdraw_member_funding extrinsic
  • added withdraw_creator_funding extrinsic
  • introduced bounty accounts.
  • introduced bounty removal in some cases

Implementation comments

  • when the cherry can't be distributed fully among the funders - the remainder gets burned
  • bounty state could be removed during either withdraw_member_funding or withdraw_creator_fundingextrinsics. The actual removal occurs when all possible withdrawals are completed.

Open questions

  • Should we migrate a council budget to the account to eliminate slashes/deposit_creations?
  • How do we prevent bad bounty creation (eg.: funding_period = 0, creator_funding = 0)? Should we limit active bounties number for a member or we rely on the extrinsic fee?

Main issue

@shamil-gadelshin shamil-gadelshin marked this pull request as ready for review February 11, 2021 16:11
@bedeho
Copy link
Member

bedeho commented Feb 11, 2021

Should we migrate a council budget to the account to eliminate slashes/deposit_creations?

I did not understand this question, could you restate?

How do we prevent bad bounty creation (eg.: funding_period = 0, creator_funding = 0)? Should we limit active bounties number for a member or we rely on the extrinsic fee?

If we have no caps on active bounties overall, then I see no need for such a limit.

/// A bounty funding was successful on the provided block.
max_funding_reached_at: BlockNumber,
/// A bounty reached its maximum allowed contribution on creation.
reached_on_creation: bool,
Copy link
Member

Choose a reason for hiding this comment

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

Why is reached_on_creation needed? I see it only read here

cherry_needs_withdrawal: reached_on_creation && cherry_is_not_zero,

but it's also not clear this field is needed, or why it depends on anything except cherry_is_not_zero.

/// The stage is set when the funding exceeded max funding amount.
MaxFundingReached(BlockNumber),
/// Creator funds (initial funding and/or cherry) were withdrawn.
CreatorFundsWithdrawn,
Copy link
Member

Choose a reason for hiding this comment

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

Why is there a distinct extrinsic and thus milestone for withdrawing funding? All there is is bounty cancellation?

See design doc

The creator can cancel at any time before this, something that is of particular importance of in perpetual funding periods. If no one has contributed, any cherry is returned and the bounty is instantl removed, but if at least one contributor has funded, then the cherry will be split amont all contributors, and the bounty goes to the withdraw period.

So cancelling a bounty covers possible recovery of bounty contributed, if relevant. Right now you have two separate extrinsics and milestones. I am not actually sure you even need two Canceled and CreatorFundsWithdrawn even if we wanted two separate extrinsics, as the runtime should do the exact same thing going forward in both cases?

Copy link
Contributor

@conectado conectado left a comment

Choose a reason for hiding this comment

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

Overall benchmarking looks great, just left one minor comment and one important question.


assert!(Bounties::<T>::contains_key(bounty_id));

Bounty::<T>::cancel_bounty(RawOrigin::Root.into(), creator.clone(), bounty_id).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add an assertion after this that the stage is BountyStage::Withdrawal with cherry_needs_withdrawal == true? (The same for the other benchmark for withdraw_creator_funding.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor

@conectado conectado left a comment

Choose a reason for hiding this comment

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

LGTM

@bedeho bedeho merged commit 83cbaec into Joystream:bounty Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants