Repository navigation
fix(transaction): validate DataEntry fields for XDR encoding limits - #870
Merged
Merged
Conversation
…orokit#762) - Validate key and value lengths against Stellar XDR 64-byte limits - Support string, Uint8Array, and Buffer DataEntryValue inputs - Compute exact UTF-8 byte length to prevent multi-byte silent overflow - Return clear validation error messages with limit and actual byte size - Add setData and deleteData aliases across transaction, compose, and client - Add comprehensive unit and integration test coverage
|
@Gezziy 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.
closes #762
Summary of Changes
string64for keys,opaque dataValue<64>for values).getDataByteLengthusingTextEncoderfor UTF-8 strings (avoiding UTF-16 code unit mismatch where emojis and multi-byte characters exceed 64 bytes despite small string length) and native.byteLengthforUint8Array/Buffer."Data entry value exceeds maximum limit of 64 bytes (actual: X bytes).""Data entry key exceeds maximum limit of 64 bytes (actual: X bytes)."loadAccountRPC calls.Uint8Arraypayloads toBufferwhen building Stellar SDK operations.setDataanddeleteDataaliases insrc/transaction/,ComposeBuilder, andcreateSorokitClient.ts.src/tests/dataEntry.test.tscovering ASCII limits, multi-byte UTF-8 emojis, binary buffers, compose workflows, and client methods.Reason for Changes
Resolves issue #762. Previously, setting account data via
setDatadid not validate value byte length against XDR limits. Oversized values resulted in silent on-chain truncation or opaque Horizon ingestion rejections (op_malformed). Early client-side validation prevents data corruption and unnecessary network overhead.