Skip to content

[Bug] solana.core.Message.from(byteArray) deserialization bug #120

Description

@Funkatronics

Describe the bug
Trying to build a Transaction object from an array of bytes throws an exception. The exception is thrown by the call to solana.core.Message.from(byteArray) inside of the Transaction.from() method.

To Reproduce

  • create an NFT mint transaction (in my case I am using CreateNftTransactionBuilder().build() from the metaplex-android lib)
  • partial sign the transaction with the payer/owner account
  • serialize the transaction using Transaction.serialize()
  • try to rebuild the transaction object from the serialized bytes using Transaction.from(serializedBytes)

Expected behavior
Transaction.from(serializedBytes) should work the same as manually building the transaction like so (this is our current workaround):

Transaction().apply {
       setRecentBlockHash(recentBlockhash)
       feePayer = creator
       addInstruction(instructions)
       addSignature(creator, primarySignatureFromMwa)
}

SDK Version & Context
Platform: Android
Version: solana-kt:2.0.0

Additional context
We are using metaplex and solanaKT with Mobile Wallet Adapter. Mobile wallet adapter uses raw byte arrays to pass around and sign transactions. This is why we need to serialize the Transaction object into bytes (for MWA signing), then rebuild the Transaction object from the signed bytes (so it can then be passed to sendTransaction or other solanakt/metaplex methods). When fixing this, I am may add some other methods/abstractions to better support raw byte array transactions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions