-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(svm): allow Phantom and Solflare Lighthouse instructions in transaction verification #991
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
feat(svm): allow Phantom and Solflare Lighthouse instructions in transaction verification #991
Conversation
✅ Heimdall Review Status
|
|
@aptum11 is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks a lot for the contribution @aptum11, looping in @CarsonRoscoe for a review |
|
Could you please also update There is #829 by @notorious-d-e-v but it seems this PR is much stricter than the spec changes suggested in #829. So its my understanding this PR is a temporary, pragmatic workaround, while we figure out how to open up the specs for more stuff like smart wallets? |
|
Given that we currently aim to specifically support Phantom/Solflare, would it be possible to have an even stricter check for the exact instructions injected by those wallets? |
|
Thanks for the review.
Regarding #829 - you're right that this PR takes a more conservative approach. This PR is narrowly scoped to allow only Lighthouse program instructions as the 4th/5th instruction. This is a pragmatic fix for the immediate problem of Phantom and Solflare wallets failing verification because they inject these protection instructions on mainnet. My understanding is that this PR serves as a temporary, targeted workaround to unblock Phantom/Solflare users now, while the broader discussion in #829 figures out the right way to generalize the spec for smart wallets and other wallet-injected instructions without compromising security. Happy to align with the direction from #829 once those spec changes are finalized, but wanted to ship this fix to address the immediate user-facing issue.
Good question. We considered stricter whitelisting of exact instruction data, but decided against it for a few reasons:
We found the current solution to be a good balance of practicality and security. |
df62f78 to
b69fdef
Compare
|
Thanks a lot for the explanation @aptum11 and updating the specs! In the meanwhile, could you please verify your commit? See here for instructions: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification |
|
I was advocating for the outcome-based approach in #828 and still think that's the cleaner long-term architecture. But that discussion has stalled for over a month now. @aptum11's reasoning here is sound - Lighthouse is assertion-only, worst case is tx failure not fund loss. The pragmatic move is to ship this and revisit if #829 ever lands. |
…saction verification Phantom and Solflare wallets inject Lighthouse program instructions for user protection on Solana mainnet transactions. This causes x402 verification to fail because the scheme expects exactly 3 instructions. This change allows optional 4th and 5th instructions specifically from the Lighthouse program (L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95): - 4th instruction: Phantom wallet protection (1 Lighthouse instruction) - 5th instruction: Solflare wallet protection (adds 2 Lighthouse instructions) Changes: - Add LIGHTHOUSE_PROGRAM_ADDRESS constant (TypeScript and Go) - Update ExactSvmScheme verify to allow 3-5 instructions - Update ExactSvmSchemeV1 verify to allow 3-5 instructions - Reject any 4th/5th instruction that is not from Lighthouse program - Add error constants for unknown 4th/5th instructions - Update scheme_exact_svm.md spec to reflect changes Fixes: coinbase#828
b69fdef to
f0b36de
Compare
CarsonRoscoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Forgot we have a python v2 now 😅 you mind following this up with the equivalent changes there @aptum11? |
Description
Phantom and Solflare wallets inject Lighthouse program instructions for user protection on Solana mainnet transactions. This causes x402 transaction verification to fail because the facilitator scheme expects exactly 3 instructions (ComputeLimit + ComputePrice + TransferChecked).
This change allows optional 4th and 5th instructions specifically from the Lighthouse program (
L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95):Changes:
LIGHTHOUSE_PROGRAM_ADDRESS/LighthouseProgramAddressconstant (TypeScript and Go)ExactSvmSchemeverify to allow 3-5 instructionsExactSvmSchemeV1verify to allow 3-5 instructionsPotentially Closes #828
Tests
These changes have been tested in production at PayAI with both Phantom and Solflare wallets on Solana mainnet. PR discussed with @notorious-d-e-v.
The verification logic changes are minimal and defensive:
Checklist