-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simplify identifier length validation (#960)
* refactor: simplify identifier length validation Firstly, remove asserts from the validate_identifier_length and validate_prefix_length functions. Instead, let the regular checks handle cases where min and max constraints don’t allow for a valid prefix to exist. Secondly, ensure minimum length constraints is at least one. This makes sure that the validation functions will check for empty identifiers and prefixes. This makes empty identifier check in validate_channel_identifier as well as Error::Empty variant unnecessary so get rid of those too. Lastly, collapse all checks in validate_prefix_length into a single call to validate_identifier_length with correctly adjusted min and max constraints. Issue: #959 * log * Update 960-simplify-length-validation.md Signed-off-by: Michal Nazarewicz <[email protected]> * tests * Update and rename 960-simplify-length-validation.md to 961-simplify-length-validation.md Signed-off-by: Michal Nazarewicz <[email protected]> * update changelog entry * revert error variant deletion * refactor id validation tests * use numeral consistently --------- Signed-off-by: Michal Nazarewicz <[email protected]> Co-authored-by: Ranadeep Biswas <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
54 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.changelog/unreleased/breaking-changes/961-refactor-identifier-validation.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Simplify and refactor ICS-24 identifier validation logic. | ||
([\#961](https://github.com/cosmos/ibc-rs/issues/961)) |
This file contains 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