-
Notifications
You must be signed in to change notification settings - Fork 49
Settlement Locking #1818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Settlement Locking #1818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()
let (caller_did, sk, instruction_details) = | ||
Self::ensure_origin_perm_and_instruction_validity(origin, id, true)?; | ||
let origin_data = pallet_identity::Pallet::<T>::ensure_origin_call_permissions(origin)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a call to ensure_instructino_validity
anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored that for improved readability. The same guarantees are achieved by the new match statement added bellow. If the InstructionStatus::Pending
only manual instructions that have reached their block can be executed.
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
changelog
new features
SettleAfterLock
instructions;new external API
MaximumLockPeriod
associated type to the settlement pallet;LockedTimestamp
;lock_instruction
;lock_instruction_weight
,instruction_asset_count
;new events
InstructionLocked
variant to the settlement pallet;other
venue_for_management
is now calledensure_venue_creator
;reject_instruction
weight calculation;prune_instruction
performance;ensure_valid_caller
function for removing code duplication;UnexpectedSettlementType
,InvalidInstructionStatusForRejection
;LockTimestampNotFound
,ExceededMaximumLockingPeriod
,FailedAssetTransferringConditions
;