Repository navigation
Conversation
MemoValidationService.validate() only checked length when enforceMaxLength was true, which defaulted to undefined, so an over-length memo validated as isValid: true. Enforce MEMO_MAX_BYTES unless the caller explicitly passes enforceMaxLength: false.
|
@snowrugar-beep 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.
Summary
MemoValidationService.validate()now enforces the 28-byteMEMO_TEXTlimit by default, instead of only checking length when the caller opted in. An over-length memo is reported as invalid with an error naming the limit and the actual byte length, and the sanitized value is truncated to 28 bytes.Problem
validate()guarded its length check behindoptions.enforceMaxLength, which defaulted toundefined. As a resultvalidate({ memo: 'x'.repeat(100) })returnedisValid: true, so an over-length memo that the network would reject sailed straight through validation (#603, #818).Changes Made
src/utils/validation/memo.service.ts: the guard is nowoptions.enforceMaxLength !== false, so the limit applies unless a caller explicitly opts out.src/utils/validation/memo.types.ts: updated theenforceMaxLengthdocumentation to describe the new default.Implementation Details
Length enforcement is now on by default; passing
enforceMaxLength: falseremains the single explicit opt-out. The existing behaviour for an over-length memo is otherwise unchanged —isValidisfalse,errornames both the limit and the supplied byte count (e.g.Memo exceeds max length of 28 bytes (got 100)), andsanitizedMemois truncated to the first 28 bytes so a UI still has a usable value. Short memos are unaffected.Closes #820
Closes #819
Closes #818