Skip to content

[Assets] Implement pallet-assets-holder#4530

Merged
gui1117 merged 105 commits intoparitytech:masterfrom
pandres95:pallet-assets-holder
Feb 17, 2025
Merged

[Assets] Implement pallet-assets-holder#4530
gui1117 merged 105 commits intoparitytech:masterfrom
pandres95:pallet-assets-holder

Conversation

@pandres95
Copy link
Copy Markdown
Contributor

@pandres95 pandres95 commented May 21, 2024

Closes #4315

@pandres95 pandres95 requested a review from a team as a code owner May 21, 2024 05:43
@pandres95 pandres95 marked this pull request as draft May 21, 2024 05:43
@pandres95 pandres95 force-pushed the pallet-assets-holder branch from c627c51 to 89ea43a Compare June 17, 2024 16:53
…th the tokens' _balance components_ model.

On the most recent documentation about tokens (both _fungible_ and _fungibles_ (sets)), the model for calculating the different balance components is explained. The prior implementation of `pallet-assets` featured a weird definition of how to handle them that was not in line with the expected (see <https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/tokens/fungible/index.html#holds-and-freezes>) definition of tokens.

This commit changes this implementation for methods `reducible_balance` and `can_decrease` to introduce the calculation of `spendable` balance, and the consequences derived of decreasing a balance that may include both `frozen` and `held` balances.
@pandres95 pandres95 marked this pull request as ready for review July 11, 2024 09:45
@pandres95 pandres95 requested review from a team and athei as code owners July 11, 2024 09:45
@bkchr
Copy link
Copy Markdown
Member

bkchr commented Jul 24, 2024

@joepetrowski @muharem can you please take a look at this and if we need this?

Copy link
Copy Markdown
Contributor

@muharem muharem left a comment

Choose a reason for hiding this comment

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

@pandres95 I do not really understand the plan. I see only first step in the issue. also are you sure we need this new trait? can we do the same with fungibles traits? I see that we have a similar FrozenBalance trait, but it probably was introduced before the fungibles was. can we bring the hold implementation with a single PR? it would make it more clear and we get it faster. this PR wont bring anything useful, only breaking changes.

@pandres95
Copy link
Copy Markdown
Contributor Author

pandres95 commented Jul 25, 2024

Sure! Can complete the second step in the same PR.

The reason behind this trait is that in some prior meeting Gav advised against exhaustively modifying some core pallets like pallet-assets and instead recommended extending them. That is, precisely the reasoning for having created pallet-assets-freezer.

@muharem
Copy link
Copy Markdown
Contributor

muharem commented Jul 25, 2024

@pandres95 yes, it should be done as an extension. there is also a died hook, the new trait make sense to me now.
so I would only advise to have a single PR, since HeldBalance along does not bring anything, and only breaking changes.
if introduced and merged separately, it is possible to get the HeldBalance and the holder pallet in different release versions. Two separate audits would be required. also I think we can review it better in a single PR.

@pandres95 pandres95 changed the title [Assets] Define HeldBalance [Assets] Implement pallet-assets-holder Jul 29, 2024
@paritytech-review-bot paritytech-review-bot bot requested a review from a team August 1, 2024 02:28
@pandres95
Copy link
Copy Markdown
Contributor Author

@muharem the pallet implementation is done and ready to review

@pandres95 pandres95 requested a review from muharem August 1, 2024 02:33
@pandres95 pandres95 restored the pallet-assets-holder branch February 18, 2025 15:54
gui1117 added a commit that referenced this pull request Feb 19, 2025
gui1117 added a commit that referenced this pull request Feb 19, 2025
clangenb pushed a commit to clangenb/polkadot-sdk that referenced this pull request Feb 19, 2025
Closes paritytech#4315

---------

Co-authored-by: Guillaume Thiolliere <guillaume.thiolliere@parity.io>
EgorPopelyaev pushed a commit that referenced this pull request Feb 20, 2025
… 2503 (#7616)

This reverts commit 83db047.

Sorry, I pushed the merge button before the audit of the PR, this
reverts the commit for `stable2503` branch

For master branch seee:
#7615
@pandres95 pandres95 deleted the pallet-assets-holder branch March 31, 2025 05:13
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
Closes paritytech#4315

---------

Co-authored-by: Guillaume Thiolliere <guillaume.thiolliere@parity.io>
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
Closes paritytech#4315

---------

Co-authored-by: Guillaume Thiolliere <guillaume.thiolliere@parity.io>
pandres95 added a commit to virto-network/polkadot-sdk that referenced this pull request Apr 23, 2025
Closes paritytech#4315

---------

Co-authored-by: Guillaume Thiolliere <guillaume.thiolliere@parity.io>
@pandres95 pandres95 mentioned this pull request Jul 14, 2025
20 tasks
@rachsrl rachsrl moved this from Backlog to Scheduled in Security Audit (PRs) - SRLabs Mar 23, 2026
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

Status: Scheduled
Status: Done

Development

Successfully merging this pull request may close these issues.

Define and implement Hold for Assets