Skip to content

feat: add validate_claim_type and comprehensive validation test suite#237

Merged
Haroldwonder merged 2 commits intoHaroldwonder:mainfrom
Mozez155:link-3
Mar 27, 2026
Merged

feat: add validate_claim_type and comprehensive validation test suite#237
Haroldwonder merged 2 commits intoHaroldwonder:mainfrom
Mozez155:link-3

Conversation

@Mozez155
Copy link
Copy Markdown

closes #118

Add a new validate_claim_type function that rejects empty strings, claim
types longer than 64 characters, and any character outside [A-Za-z0-9_-].
Wire it into create_attestation, create_attestations_batch,
register_claim_type, and request_attestation.

Add InvalidClaimType = 28 to the Error enum.

Add a validation_tests module (30 tests) covering every validation function
with negative paths, boundary values, and no-state-change assertions:

  • validate_claim_type: empty, >64 chars, space/dot/@, boundary at 64,
    underscore/hyphen allowed, via register_claim_type
  • require_admin: wrong address, uninitialized contract, no state change
  • require_issuer: unregistered, removed issuer, no state change
  • validate_native_expiration: past, equal-to-now, future, None, no state change
  • validate_metadata: 257-char rejected, 256-char accepted
  • validate_tags: 6 tags rejected, tag >32 chars rejected
  • validate_reason: 129-char rejected, 128-char accepted
  • validate_import_timestamps: future timestamp, expiration before timestamp
  • require_not_paused: paused contract rejects writes

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@Mozez155 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! 🚀

Learn more about application limits

@Haroldwonder Haroldwonder merged commit 2ea1b40 into Haroldwonder:main Mar 27, 2026
0 of 3 checks passed
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.

Testing: Add negative test cases for all validation functions

2 participants