Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Possible bug in Deserialize/Serialize Transaction #446

Open
Needleski opened this issue Mar 17, 2024 · 1 comment
Open

[Bug] Possible bug in Deserialize/Serialize Transaction #446

Needleski opened this issue Mar 17, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Needleski
Copy link

Describe the bug
Im trying to write (I thought) a simple transaction which takes 1 SOL and sends back an NFT from a different wallet. As far as I understand, this is just 3 instructions and 2 signatures:

  1. Transfer SOL from A to B
  2. CreateAssociatedTokenAccount in A for NFT
  3. Transfer NFT from B to A

This message is created server side. I then use CompileMessage() to compile the message to a byte array and send to the client. The client signs and sends the signed TX back. The server then checks the transaction is valid (hasnt been tampered with), signs and sends the transaction on chain.

Ive been working on this all weekend and keep getting the same error "Transaction signature verification failure". So, Ive commented everything out, except instruction 1 (transfer SOL from A to B). It worked. After several hours of un-comment and commenting later, Ive found something which has left me stumpped.

This works

byte[] signedClientTransaction = [ ...... This is the signed TX from the client ...... ];
var result = await _rpcClient.SendTransactionAsync(signedClientTransaction , commitment: Commitment.Finalized);

This fails with "Transaction signature verification failure"

byte[] signedClientTransaction = [ ...... This is the signed TX from the client ...... ];
var transaction = Transaction.Deserialize(signedClientTransaction);
signedClientTransaction = transaction.Serialize();
var result = await _rpcClient.SendTransactionAsync(signedClientTransaction , commitment: Commitment.Finalized);

Surely Deserializing and then Serializing the same transaction should do nothing? Am I missing something?

To Reproduce
See above

Expected behavior
I would expect deserializing and serializing the same transaction to have no effect.

Desktop (please complete the following information):

  • OS: Windows
  • Browser N/A
  • Version Latest
@Needleski Needleski added the bug Something isn't working label Mar 17, 2024
@Neo-vortex
Copy link
Contributor

related : #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants