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

Crowdload burn remaining funds #3707

Merged
merged 5 commits into from
Mar 17, 2024
Merged

Crowdload burn remaining funds #3707

merged 5 commits into from
Mar 17, 2024

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Mar 14, 2024

Crowdloan account should burn all funds after a crowd loan got dissolved to ensure that the account is reaped correctly.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added the R0-silent Changes should not be mentioned in any release notes label Mar 14, 2024
Copy link
Contributor

@franciscoaguirre franciscoaguirre left a comment

Choose a reason for hiding this comment

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

Makes sense

polkadot/runtime/common/src/crowdloan/mod.rs Outdated Show resolved Hide resolved
polkadot/runtime/common/src/crowdloan/mod.rs Show resolved Hide resolved
ggwpez and others added 2 commits March 15, 2024 15:39
@@ -576,7 +577,10 @@ pub mod pallet {
// can take care of that.
debug_assert!(Self::contribution_iterator(fund.fund_index).count().is_zero());

frame_system::Pallet::<T>::dec_providers(&Self::fund_account_id(fund.fund_index))?;
// Crowdloan over, burn all funds.
let _imba = CurrencyOf::<T>::make_free_balance_be(&pot, Zero::zero());
Copy link
Contributor

Choose a reason for hiding this comment

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

dq but I don't get why this is needed; a CL is dissolve-able only when all funds are already returned, no? if not, I think it should be like this.

seems to be checked as a part of let can_dissolve = permitted && fund.raised.is_zero();

So the invariant is fund.raised should always be equal to CurrencyOf::<T>::free_balance(&pot)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh okay, reading the test I realize that this is catering for the cases where a manual transfer happens to the fund account.

@ggwpez ggwpez added this pull request to the merge queue Mar 17, 2024
Merged via the queue into master with commit d2a7100 Mar 17, 2024
133 of 135 checks passed
@ggwpez ggwpez deleted the oty-crowdload-provider-refs branch March 17, 2024 13:46
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Mar 24, 2024
Crowdloan account should burn all funds after a crowd loan got dissolved
to ensure that the account is reaped correctly.

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants