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

migrate pallet-fast-unstake to fungible::* trait family #1772

Closed
wants to merge 3 commits into from

Conversation

kianenigma
Copy link
Contributor

part of #226.

Note that many other pallets could possibly use the Consideration api if they are purely holding deposits. In the case of this pallet, I decided to tap into the fungible::* traits directly because the type of deposit held in this pallet is fixed, and very rudimentary. We don't want to care about if type Deposit even changes. The pallet should at any point put Deposit::get() on hold, and upon successful operation, should release all of it.

I think for these pallets the fungible based approach is better because it gives you the ability to stop tracking the amount of deposit held. Contrary, in the Consideration you need to store the ticket so that you can update or release the deposit.

I might nonetheless try this approach as well.

The PR contains some logical changes to the pallet and a migration, namely because, as noted above, we no longer need to store the deposit amount.

@kianenigma kianenigma added the R0-silent Changes should not be mentioned in any release notes label Oct 2, 2023
@kianenigma kianenigma requested a review from athei as a code owner October 2, 2023 14:45
@kianenigma kianenigma requested review from a team October 2, 2023 14:45
@kianenigma kianenigma changed the title migrate pallet-fast-unstake to fungible::* trait family migrate pallet-fast-unstake to fungible::* trait family Oct 2, 2023
@kianenigma
Copy link
Contributor Author

I was under the impression that this pallet has some bound on the total size of the queue and therefore can be migrated in a one-off manner. But I see now that there is bound, so I need to rework this into a lazy migration.

@@ -247,8 +247,7 @@ pub mod pallet {
type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>;

/// The fungible in which fees are paid and contract balances are held.
type Currency: Inspect<Self::AccountId>
+ Mutate<Self::AccountId>
type Currency: Mutate<Self::AccountId>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this change made? Seems totally independent

Copy link
Contributor

@PieWol PieWol Oct 8, 2023

Choose a reason for hiding this comment

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

I think it was a useless line as Inspect is a subtrait to Mutate

edit: nvm, just realized it's a whole different pallet.

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/3895814

Comment on lines +600 to +606
let _ = T::Currency::burn_all_held(
&HoldReason::FastUnstake.into(),
&stash,
Precision::BestEffort,
// This is not a system-level slash, so we politely do our best to slash.
Fortitude::Polite,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

slash_reserved created a negative imbalance, whereas burn_all_held just burns it. Don't we still need that negative imbalance?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we need to slash instead of burn, we might need a slash_all_held

bkchr pushed a commit that referenced this pull request Apr 10, 2024
* crate-level docs for the parachains pallet

* fix typos
@kianenigma kianenigma closed this Jul 17, 2024
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.

5 participants