Repository navigation
feat: #1087 create validation helper utilities - #1119
Merged
Eniola3321 merged 1 commit intoSep 30, 2026
Merged
Conversation
- Add require_positive_u32 for non-zero u32 checks - Add validate_basis_points with configurable max BPS - Add validate_range_u32 for inclusive numeric range validation - Add validate_positive_i128 for positive price/amount checks - Add validate_not_contract_address to reject self-address inputs - Add validate_not_blacklisted integrating with blacklist module - Add validate_option_address for Option<Address> presence checks - Add validate_non_empty_string for empty string rejection - Add validate_string_length for max-size enforcement - Add validate_uri_protocol for https/ipfs/ar scheme validation - Add validate_token_id_exists using token_owner_storage - All helpers use canonical Error definitions from types.rs - Register pub mod validation_helpers in lib.rs - Add comprehensive unit tests for all helpers
|
@Adedayo-Data Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
PR 4 —
feat/1087-validation-helpers→mainTitle: feat: #1087 [Validators] Create Validation Helper Utilities
Description:
Closes #1087
Summary
Introduces a new
validation_helpersmodule containing shared, reusable validation utilities for common operations across the contract. Eliminates duplicated validation logic and ensures all modules use the canonical error definitions fromtypes::Error.Changes
validation_helpers.rs— new module with:require_non_zero_u32— rejects zero u32 values (InvalidConfig)validate_basis_points— validates BPS within configurable max (InvalidBasisPoints)validate_within_range_u32— validates inclusive numeric range (InvalidConfig)validate_address_not_contract— rejects the contract's own address (InvalidAddress)validate_address_not_blacklisted— integrates withblacklistmodule (InvalidAddress)validate_not_zero_address— rejectsNoneoptional addresses (InvalidAddress)validate_string_non_empty— rejects empty strings (InvalidURI)validate_string_max_len— enforces maximum string size (MetadataSizeTooLarge)validate_uri_scheme— enforceshttps://,ipfs://,ar://protocols (UnsupportedProtocol)validate_token_exists— checks token ownership record existence (TokenNotFound)Acceptance Criteria
types::Error)