Skip to content

Brave doesn't work if there is a partial sign with different fee payer #83

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

Closed
yamijuan opened this issue Mar 7, 2023 · 5 comments
Closed

Comments

@yamijuan
Copy link

yamijuan commented Mar 7, 2023

We have the case where we want to cover any transaction fees for the user so the way we currently have it is as follows:

  • Ask the backend for a transaction
  • Creates a transactions
  • set feePayer as the keypair's public key we have stored
  • partially sign the tx `transacation.partialSign(feePayerKP)
  • serialize the tx in base64
  • send to the frontend
  • recover transaction with Buffer.from and Transaction.from
  • call sendTransaction from wallet adapter

What happens at this point is brave wallet pops up but without any action, just the account info and it gets stuck there forever

What we did to fix it is instead of calling sendTransaction from wallet adapter, we call signTransaction and sign the tx and the send it with connection.sendRawTransaction after serialize it. This fix got us to believe there is an issue in brave implementation on wallet.signAndSendTransaction that's being used in brave's sendTransaction in its adapter

Also removing the feepayer and the signature works too. Someone from our team thinks it might be an issue with signature order in brave.

with @steveluscher 's permission, here is a video https://drive.google.com/file/d/14jX-Fqds9oBCwDgNkcJxWmmodB_tpX-P/view

@yamijuan yamijuan changed the title Brave doesn't work if there is a partial sign with different fee pay Brave doesn't work if there is a partial sign with different fee payer Mar 7, 2023
@steveluscher
Copy link
Collaborator

@yamijuan, can you quickly test what happens here if you call window.solana.signAndSendTransaction() directly?

@mcintyre94
Copy link
Collaborator

mcintyre94 commented Mar 8, 2023

FWIW this is a use case we've seen with Solana Pay, where the transaction served will be partially signed for various reasons

I've been able to repro this issue with a slightly modified version of our solana-pay-scaffold: https://github.com/mcintyre94/solana-pay-scaffold (change-fee-payer branch)

To test it, copy .env.example to .env, put any private key with devnet SOL in as WALLET_PRIVATE_KEY, yarn, yarn dev. Click connect wallet (use a different one to the .env one) and then send with wallet on the transaction request page (localhost:3000/)

The main branch uses a simple transaction with no other signers and works correctly in Brave, the change-fee-payer branch has the same issue reported here

I've also tested the window.solana.signAndSendTransaction() and the behaviour is exactly the same

@steveluscher
Copy link
Collaborator

Moving this discussion over to brave/brave-browser#28955.

(@jordansexton, I can't close this issue myself)

@jordaaash
Copy link
Collaborator

Closed per @steveluscher, thanks for looking into this everyone!

@yrliou
Copy link

yrliou commented Mar 13, 2023

@yamijuan Thanks for the report, we've merged a fix in Brave Nightly, it should be working now on our latest Nightly, if you could help confirm that it's also fixed on your end, that would be great. We're in the process of uplifting the fix into Brave Beta and Brave Release, for Brave Beta, it could be this or next week, and for Brave Release, current planned release date is 03/22 (next week). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants