fix(tips): pad tip code payload with incrementing digits instead of zeros - #1163
Merged
Merged
Conversation
…eros The tip code frame wrote a 16-byte user id and left the 3 reserved trailing bytes as zeros. The native Kik scanner strips trailing zero bytes on decode, so those frames came back short. Fill the reserved space with incrementing digits (1, 2, 3) so the frame ends non-zero and round-trips at full length.
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
The tip code scan frame (
PayloadKind.Tip, kind byte2) wrote a 16-byte user id at offset 1 and left the 3 reserved trailing bytes (17–19) as zeros. The native Kik scanner strips trailing zero bytes on decode, so those frames came back short.This fills the reserved trailing space with incrementing digits (
1, 2, 3) instead of zeros, so the frame always ends non-zero and round-trips at full length.Changes
PayloadKind.Tip.encode— fill the reserved region (offset 17 onward) with1, 2, 3instead of leaving zeros.OpenCodePayload.kt— updated the Layout 2 frame diagram/comment.OpenCodePayloadTests.kt— updated the assertion fromlistOf<Byte>(0, 0, 0)tolistOf<Byte>(1, 2, 3).Decoding is unaffected —
Tip.decodereads only the 16-byte user id and ignores the reserved bytes. The cash frames are unchanged (they already fill all 20 bytes with currency/quarks/nonce).Testing
:services:opencode:compileDebugKotlin✅:services:opencode:compileDebugAndroidTestKotlin✅