Fix transfer reports - #2006
Merged
Merged
Fix transfer reports#2006
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical weight and NFT report-coverage issues remain unresolved, along with documentation and test gaps.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates transfer reporting for frozen holdings and prevents NFT locking from frozen portfolios.
Changes:
- Adds frozen-holder and frozen-balance validation to transfer reports.
- Rejects NFT locks from frozen holders.
- Updates settlement regression expectations.
File summaries
| File | Changes and review findings |
|---|---|
pallets/runtime/tests/src/settlement_pallet/transfer_funds.rs |
Updates the expected frozen-portfolio transfer error. |
pallets/nft/src/lib.rs |
Adds frozen-holder reporting and blocks NFT locking from frozen holders. Critical (2 votes): add report-level coverage for InvalidTransferSenderIsFrozen. |
pallets/asset/src/lib.rs |
Adds frozen-holder and frozen-balance checks. Critical (1 vote): regenerate report weights for the added storage reads. Nits (2 votes each): update documented skip_locked_check semantics and add report-level coverage for full/partial freezes. |
Review details
Suppressed comments (2)
pallets/asset/src/lib.rs:3745
- When
skip_locked_checkis false,ensure_sufficient_balance(..., false)below already callsensure_holder_is_not_frozenand returns the same error. This new check therefore appendsInvalidTransferSenderIsFrozentwice for a frozen sender in the normal transfer report (the precompile uses this mode), making the report contain duplicate errors. Restrict the explicit check to theskip_locked_checkbranch, where the balance path intentionally bypasses it.
if let Err(e) = Self::ensure_holder_is_not_frozen(sender, asset_id) {
asset_transfer_errors.push(e);
}
pallets/nft/src/lib.rs:1480
lock_nftis called once per NFT by settlement's sender-affirmation paths, so this check adds oneFrozenAccounts/FrozenPortfoliosread per NFT. The generated weights for those paths (affirm_instruction,affirm_with_receipts, andadd_and_affirm_with_mediators) contain no holder-freeze storage reads and still use the old per-NFT counts, allowing an affirmation to exceed its declared weight. Regenerate the affected settlement weights after adding this check.
pallet_asset::Pallet::<T>::ensure_holder_is_not_frozen(&asset_holder, &asset_id)?;
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+3743
to
+3745
| if let Err(e) = Self::ensure_holder_is_not_frozen(sender, asset_id) { | ||
| asset_transfer_errors.push(e); | ||
| } |
Comment on lines
+1232
to
+1236
| if let Err(e) = | ||
| pallet_asset::Pallet::<T>::ensure_holder_is_not_frozen(sender, nfts.asset_id()) | ||
| { | ||
| nft_transfer_errors.push(e); | ||
| } |
Comment on lines
+3748
to
+3751
| let frozen_balance = Self::get_holders_frozen_balance(sender, asset_id); | ||
| let current_balance = Self::get_holders_balance(sender, asset_id); | ||
|
|
||
| if current_balance.saturating_sub(frozen_balance) < transfer_value { |
Comment on lines
3747
to
3752
| if skip_locked_check { | ||
| if Self::get_holders_balance(sender, asset_id) < transfer_value { | ||
| let frozen_balance = Self::get_holders_frozen_balance(sender, asset_id); | ||
| let current_balance = Self::get_holders_balance(sender, asset_id); | ||
|
|
||
| if current_balance.saturating_sub(frozen_balance) < transfer_value { | ||
| asset_transfer_errors.push(Error::<T>::InsufficientBalance.into()); |
HenriqueNogara
marked this pull request as ready for review
September 15, 2026 11:51
Neopallium
reviewed
Sep 15, 2026
Neopallium
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
changelog
other
transfer_reports;