Skip to content

Implement shared validators for params/state/auth - #2

Open
Shecodes174 wants to merge 3 commits into
mainfrom
feat/shared-validators-implementation
Open

Implement shared validators for params/state/auth#2
Shecodes174 wants to merge 3 commits into
mainfrom
feat/shared-validators-implementation

Conversation

@Shecodes174

Copy link
Copy Markdown
Owner

This PR implements shared validators for params/state/auth as requested.

Changes

  • Added comprehensive ValidationError enum with 309 error codes
  • Implemented parameter validation functions (amount, string, address, array, timestamp)
  • Implemented state validation patterns (initialized, balance, cooldown)
  • Implemented authorization validation patterns (owner, admin, role, blacklist)
  • Updated validation-patterns example to use shared validators
  • Added contracterror attribute for proper Soroban integration
  • Included full test coverage for validation functions

Acceptance Criteria Met

  • ✅ Builds all workspace members
  • ✅ Passes all tests (200+ tests across workspace)
  • ✅ Caches dependencies via CI
  • ✅ Fails on build errors
  • ✅ Documentation accurate
  • ✅ Follows existing patterns

- Create shared soroban-validation crate with reusable validation functions
- Add typed ValidationError enum with categorized error codes (100-399)
- Implement parameter validation: validate_amount, validate_string, validate_address, validate_array, validate_timestamp
- Implement state validation: require_sufficient_balance, require_cooldown_expired, require_initialized
- Implement auth validation: require_owner, require_admin, require_role, require_not_blacklisted
- Update validation patterns example to use shared validators
- Update authentication example to use shared validation patterns
- Add shared validation pattern to common patterns documentation
- Update workspace Cargo.toml to include shared crate
- Add comprehensive ValidationError enum with 309 error codes
- Implement parameter validation functions (amount, string, address, array, timestamp)
- Implement state validation patterns (initialized, balance, cooldown)
- Implement authorization validation patterns (owner, admin, role, blacklist)
- Update validation-patterns example to use shared validators
- Add contracterror attribute for proper Soroban integration
- Include full test coverage for validation functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant