lighthouse
lighthouse copied to clipboard
Do Solana validators prioritize transactions with security assertions?
We have an app that interacts with our Solana program at: https://explorer.solana.com/address/iLEPWontSkuaCDeg8psrxB3mVHAA39fWWRtinSJcrtJ
I'm signing solana transactions in typescript, by two means:
-
transactions signed by native solana browser extensions (SolFlare, Phantom) when sent using @solana/wallet-adapter-react useWallet sendTransaction
-
transactions signed via Magic.link's magic-sdk and then sent using a connection to RPC node created with @solana/web3.js
Option 1 is super fast, validated/confirmed in 3 to 4s
Option 2 (Magic) takes forever (up to 1 min), and most often fails
while inspecting the differences, I found out that on option 1) the transaction object has a 'compiledInstructions' array with five (05) instructions
but on option 2), even after signing, 'compiledInstructions' has only one (02) instructions
I found out that the instructions that are added by the wallet extensions are:
setComputeUnitLimit instruction
The other two that talk to the Lighthouse (Assertion Solana Program), as below:
#4 - Unknown: Unknown Raw Interact With Unknown
L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95 Input Accounts #1 - Account: AZAh9d3pdD9JaMFy734T1p9Yi1bUjHeYHUv2m8oqgncm Writable Signer Fee Payer Instruction Data 3zkF6GTy
#5 - Unknown: Unknown Raw Interact With Unknown
L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95 Input Accounts #1 - Account: EPbrYBp5oCEb7eb6FtULdizy5CuESJLsgdfhbiJonTfS Writable Instruction Data 8A8uiXy3AqR3n36X8SDrAtaSmDj5DpjX3bSqGkDY2g5iayUejwhgx4BUHD6F3KU7V89M The above transaction sent with wallet extension is: https://solscan.io/tx/UYceY467QU39u9pb9eLkbwJ9kT9hUj2NAe1eMwHN3SpAwY6Vvm8ou28aT6q41JR4i2RmQZjVVcYAFvMxUoNkZC5
An example of the txn signed and then sent with Magic is: https://solscan.io/tx/2dx9gHfb5CygoLUGpWm1Pwmcv2uPp7fojrtyxHJddi8SWbqHqM9XA4AhCbgDmPAtujy8iVfzb7sWdv566MQVMD7x (already added the computeLimit instruction to this one, but didn't solve the issue)
I'm trying to add the Lighthouse assertion instructions to the txn to be sent with Magic too. But after days debugging this, I'm not sure it's the right path.
I failed trying to run the latest lighthouse-sdk with our app, which uses @solana/web3.js 1.95 still.
I tried to install @solana/web3.js v2 and use it with lighthouse-sdk, but no good.
Then I copied over the code from the SDK into my local files, tried to import stuff directly from solana/web3 v2, no good. I spent some 2 hours reading the source code, console.logging, trying to get a handle on the encoders logic. I'm making process, but excruciatingly slowly. We lost a bunch of users cause Magic txns are not going through. I'm asking for help anywhere I can.
Any pointers?