Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a set of small improvements and refactorings in the settlement module. Key changes include:
- Renaming of "venue_for_management" to "ensure_venue_creator" and the addition of a new "ensure_valid_caller" function to reduce code duplication.
- Refinement of weight calculation functions, including new functions (prune_instruction, valid_caller_portfolio, valid_caller_venue, valid_caller_mediator) and updated arithmetic in reject_instruction_common.
- Updates to error types and benchmarking tests to align error messages and expected outcomes with the new logic.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pallets/weights/src/pallet_settlement.rs | Refactored weight functions and removed deprecated reject_instruction. |
| pallets/settlement/src/benchmarking.rs | Added benchmarks for the new caller-validating functions and instruction pruning. |
| pallets/runtime/tests/src/settlement_test.rs | Updated tests to reflect error renaming and changes in behavior. |
Comments suppressed due to low confidence (2)
pallets/weights/src/pallet_settlement.rs:1118
- The write multipliers in reject_instruction_common have been significantly reduced compared to the previous implementation. Please verify that the revised weight increments accurately reflect the intended resource costs.
.saturating_add(DbWeight::get().writes(1))
pallets/runtime/tests/src/settlement_test.rs:2450
- The error type was updated from Error::Unauthorized to Error::CallerIsNotAParty. Ensure that this change is reflected in the documentation and that all parts of the codebase consistently use the new error code.
error: Error::CallerIsNotAParty.into()
Neopallium
requested changes
Apr 29, 2025
302aabd to
6d1de4d
Compare
…_management Run benchmarks Add ensure_valid_cost check back
* Add lock instruction; Allow manual execution for locked instructions; Add simplified transfer * Add lock_instruction common benchmark * Improve benchmarks * Add unit tests * Add sample weights * Add rpc calls * Remove useless test * Fix benchmarks
df5ef0e to
2b42b65
Compare
Neopallium
requested changes
May 18, 2025
…y allow mediator to execute locked instruction
Neopallium
approved these changes
May 22, 2025
pallets/runtime/tests/src/settlement_pallet/lock_instruction.rs
Outdated
Show resolved
Hide resolved
…sociation/Polymesh into settlement-small-improvements
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
new features
SettleAfterLockinstructions;new external API
MaximumLockPeriodassociated type to the settlement pallet;LockedTimestamp;lock_instruction;lock_instruction_weight,instruction_asset_count;new events
InstructionLockedvariant to the settlement pallet;other
venue_for_managementis now calledensure_venue_creator;reject_instructionweight calculation;prune_instructionperformance;ensure_valid_callerfunction for removing code duplication;UnexpectedSettlementType,InvalidInstructionStatusForRejection;LockTimestampNotFound,ExceededMaximumLockingPeriod,FailedAssetTransferringConditions;