test: add non-base32 and null-byte rejection vectors (partial #292) - #305
Conversation
|
@DrSa7ag3 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! 🚀 |
📝 WalkthroughWalkthroughUpdated address test vectors by compacting existing tag arrays and adding ChangesAddress validation vectors
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@spec/vectors.json`:
- Around line 317-319: Add a separate vector in the vectors fixture, preserving
the existing trailing-null case, with \u0000 inserted between valid address
characters rather than at the end. Keep the embedded-null vector’s description
and expected rejection behavior aligned with the stated requirement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| "description": "embedded null byte must be rejected without crashing or truncating", | ||
| "input": { | ||
| "address": "GAYCUYT553C5LHVE2XPW5GMEJT4BXGM7AHMJWLAPZP53KJO7EIQADRS\u0000" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add a truly embedded-null test vector.
The current input places \u0000 at the end of the address, so it verifies trailing-null rejection/truncation but not an embedded null byte as stated in the PR objective. Keep this case and add another vector with the null byte inserted within the address.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@spec/vectors.json` around lines 317 - 319, Add a separate vector in the
vectors fixture, preserving the existing trailing-null case, with \u0000
inserted between valid address characters rather than at the end. Keep the
embedded-null vector’s description and expected rejection behavior aligned with
the stated requirement.
Summary
Partially addresses #292. Adds vectors confirming non-base32 characters
(digit substitution, punctuation) and an embedded null byte are safely
rejected during address detection — no panic, no truncation.
Scope note
The issue also requests rejecting lowercase and mixed-case StrKeys.
This conflicts with an existing vector already in this file
("lowercase G accepted with normalization warning",
detectmodule),which intentionally accepts lowercase and normalizes it with a
NON_CANONICAL_ADDRESSwarning rather than an error. I did not changethat behavior here — requesting maintainer clarification on #292 before
touching it, since it's existing designed behavior, not a bug.
Testing
closes #292
Summary by CodeRabbit