Improvements - #2011
Merged
Merged
Improvements#2011
Conversation
Neopallium
reviewed
Sep 18, 2026
Neopallium
requested changes
Sep 18, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical and moderate issues remain in payer handling, weight accounting, and STO transactional behavior.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request improves NFT redemption weighting, STO settlement validation, permission checks, and precompile fee-payer propagation.
Changes:
- Adds worst-case NFT redemption benchmarking and weighting.
- Rejects unsettled STO investments.
- Rejects nested
Exceptpermissions. - Adds payer-context handling for precompile dispatch.
Review findings:
pallets/nft/src/lib.rs:336— Moderate (1 vote): Preserve dynamic weighting for NFT EVM burns or update precompile gas accounting.pallets/precompiles/src/common.rs:121— Critical (1 vote): Preserve an existing resolved payer instead of overwriting it with the signed origin.pallets/precompiles/src/common.rs:121— Critical (2 votes): Account for the added payer storage accesses in wrapper weight or gas charges.pallets/sto/src/lib.rs:1063— Moderate (3 votes): Regenerate STO benchmark weights for the added instruction-status read.pallets/sto/src/lib.rs:1063— Critical (1 vote): Make the complete investment flow transactional to prevent partial state changes.pallets/sto/src/lib.rs:380— Nit (2 votes): Clarify the error description for instructions that were not successfully settled.pallets/weights/src/pallet_nft.rs:304— Critical (3 votes): Use the measured worst-case redemption weight instead of zero.
File summaries
| File | Summary |
|---|---|
pallets/weights/src/pallet_nft.rs |
Adds NFT worst-case redemption weight implementation. |
pallets/sto/src/lib.rs |
Validates settlement success before completing investments. |
pallets/runtime/tests/src/sto_test.rs |
Adds mediator settlement coverage. |
pallets/runtime/tests/src/nft.rs |
Removes obsolete redemption validation test. |
pallets/runtime/tests/src/external_agents_test.rs |
Tests nested Except rejection. |
pallets/precompiles/src/lib.rs |
Adds transaction-payment configuration. |
pallets/precompiles/src/common.rs |
Adds payer context around nested dispatch. |
pallets/precompiles/Cargo.toml |
Adds transaction-payment dependency features. |
pallets/nft/src/lib.rs |
Uses worst-case redemption weight. |
pallets/nft/src/benchmarking.rs |
Adds worst-case redemption benchmark. |
pallets/identity/src/keys.rs |
Rejects nested Except permissions. |
Cargo.lock |
Records the new dependency. |
Review details
Suppressed comments (1)
pallets/nft/src/lib.rs:336
Common::call_runtimechargescall.get_dispatch_info().call_weight, and the NFT EVM precompile still passes the collection's actual key count to avoid the max-case charge (pallets/precompiles/src/interface/nft/polymesh_specific.rs:127-141). This annotation ignores that parameter, so every EVM burn is now charged the worst-case weight (and may exceed normal gas limits once the zero weight is regenerated). Preserve a dynamic-weight path for the precompile or update the precompile and its gas accounting together.
#[pallet::weight(<T as Config>::WeightInfo::worst_case_redeem_nft())]
- Files reviewed: 11/12 changed files
- Comments generated: 6
- 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
+1063
to
+1066
| if !matches!( | ||
| InstructionStatuses::<T>::get(instruction_id), | ||
| InstructionStatus::Success(_) | ||
| ) { |
HenriqueNogara
marked this pull request as ready for review
September 18, 2026 13:57
Neopallium
requested changes
Sep 18, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Neopallium
approved these changes
Sep 18, 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
pallet_sto::investif settlement didn't fully execute.nft_redeembenchmark;