Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor the logic to pick the
deposit_account
in thetransfer
method. When transferring the collection item, destination account is no longer responsible for reserving deposits to create its storage record. Based on what @peterwht raised in the upstream PR, there are vulnerabilities and user experience issues identified.Issue with current design: Destination accounts are not aware of the reserved deposits associated with collection items when they are transferred. This opens the door for a malicious actor to potentially create a collection and then bulk-transfer items to various on-chain accounts.
Proposed solution: Reserving the deposit from the item owner directly makes more sense from both a user experience and chain security perspective. By doing so, the deposit is linked to the owner, reducing the risk of exploit.
Drawbacks of the approach: This method, however, is not without its complexities. For example, it may seem illogical for one account to reserve a deposit on behalf of another. But we see a similar pattern in the original
pallet-nfts
implementation ofdo_mint()
, where the reserved deposit for an item is not transferred to the new item owner during minting. This behavior is already accepted, albeit imperfect.There are room for improvements with repatriations. However, from my point of view, this is not critical and we can add that in the future!