4

I have a dApp that stopped working with resent Phantom updates. The reason behind is that Phantom started adding Priority Fee instructions (two more instructions) to the transaction payload. In my case, the fee payer is different from the user signing the transaction, that's why the dApp has security checks not allowing more than one instruction per transaction. While it is useful to have Priority Fees in place, I want to know how I can sign a transaction with Phantom without including these two more instructions so that my dApp would keep working.

Question How to disable Priority Fee's instructions when signing with Phantom?

0

2 Answers 2

6

TLDR: If you do not want Phantom (or any other wallet) to add additional instructions to your transaction then you should partially sign the transaction before requesting signature from the user.

Background: Phantom will calculate and apply Priority Fees to all transactions, provided:

  • The transaction(s) do not already have signature(s) present
  • The transaction(s) do not have existing priority fee instructions (computeUnitBudget or computeUnitLimit)
  • After enhancing transaction(s) with Priority Fees, the size of each transaction will still be less than the byte size limit (1232 bytes)

This approach came with the recommendation of Solana Labs, whose guidance is that wallets should be responsible for applying these fees instead of dApps. The reasoning behind this is that wallets can apply fees more consistently than dApps, and that this will become more necessary overtime as Solana moves towards a more dynamic fee model. If a dApp does not want priority fees (or any other instructions) added to a transaction, they should partially sign the transaction. This will programmatically enforce that the transaction cannot be tampered with.

2
  • 1
    Thank you (+1). Yes, the reasoning is clear. However I don't like that it is not possible to disable this functionality. It is inconvenient for the case when there are multiple signers and only the first one is the Phantom wallet. In my case, the other signers have validation logic to ensure they don't sign wrong transactions, in particular by verifying the number of instructions, program IDs, etc. Now this code is broken and has to be reworked. Commented May 13, 2023 at 18:35
  • In exactly same position where wallet signs first and paymaster service finalizes and pays/sponsors tx. Signing first by paymaster adds complexity as can't control sending + safeguards around app state after. Might try applying priority fee instead of signing if this also prevents it. It would be better if there was a signAndSend that included this extra logic but sign only did that.
    – uxcxdx
    Commented Nov 21, 2023 at 11:19
1

Probably a question for the phantom support. But what you could do is sign the transaction in the your dapp with some keypair, then phantom cant change it anymore.

1
  • 1
    Thank you (+1). Yes, it is possible. But this requires a lot of work in my case. There is an existing flow, in which the end user signs the transaction first and passes it further. In my case, the other signers have validation logic to ensure they don't sign wrong transactions, in particular by verifying the number of instructions, program IDs, etc. Now this code is broken and I had to rework it Commented May 13, 2023 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.