Repository navigation
fix(svm): Decode SvmSpoke events from a Uint8Array, not a Buffer - #1509
Merged
Merged
Conversation
The codama decoders populate byte-array fields by slicing their input. Slicing a Buffer yields a Buffer, so every fixed-size byte field (depositId, inputAmount/outputAmount, messageHash) came back as a Buffer rather than the Uint8Array the generated types promise, and Buffer's toString() utf8-decodes instead of joining the bytes. Feed the decoder the Uint8Array produced by @solana/kit's base64 encoder and skip the discriminator via the decoder's offset argument. Co-Authored-By: Claude <noreply@anthropic.com>
pxrl
approved these changes
Aug 10, 2026
Contributor
Author
|
Thanks for the review — nothing to address: the approval had no body and no inline comments, and you merged it ( |
Contributor
Author
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.
Fixes the two
SvmCpiEventsClient (integration)failures on #1508.decodeEventpassed aBufferto the codama decoders. They populate byte-array fields by slicing their input, andBuffer.prototype.slicereturns aBuffer— sodepositId,inputAmount,messageHashetc. came back asBuffers rather than theUint8Arraythe generated types promise.Buffer.toString()utf8-decodes instead of joining bytes, which is what the assertions tripped on:Decode with
@solana/kit's base64 encoder (returns a plainUint8Array) and skip the discriminator via the decoder'soffsetargument instead of slicing.Verified locally against a local validator:
Solana.SvmCpiEventsClient.Integration,Solana.EventDataandSolana.SvmCpiEventsClient.ForgedEvent.unitall pass, and the full suite is green.🤖 Generated with Claude Code