Skip to content

fix(sdk-coin-sol): allow WithdrawSol stake pool instruction - #9741

Open
mullapudipruthvik wants to merge 1 commit into
masterfrom
mullapudipruthvik/defi-887-allow-withdrawsol-for-jpool-unstaking-transactions
Open

mullapudipruthvik wants to merge 1 commit into
masterfrom
mullapudipruthvik/defi-887-allow-withdrawsol-for-jpool-unstaking-transactions

Conversation

@mullapudipruthvik

Copy link
Copy Markdown
Contributor

Summary

Adds the SPL Stake Pool program's WithdrawSol instruction (discriminator 16) to the Solana SDK instruction allowlist (ValidInstructionTypesEnum + VALID_SYSTEM_INSTRUCTION_TYPES).

Problem

JPool (JSOL) unstaking transactions sent via Narval/WalletConnect as customTx intents fail in production with:

500 NotSupported: Invalid transaction, instruction type not supported: WithdrawSol

Both Jito and JPool run on the same SPL Stake Pool program, but Jito unstake uses WithdrawStake (discriminator 10, already allowlisted) while JPool "Unstake with Delay" uses WithdrawSol (discriminator 16, burns pool tokens, withdraws SOL from the pool reserve). validateIntructionTypes runs inside getTransactionType during Transaction.fromRawTransaction, so these txs failed before they could even be classified as CustomTx.

JPool deposits work (DepositSol is allowlisted) — only the unstake leg fails.

Change

  • modules/sdk-coin-sol/src/lib/constants.ts: add WithdrawSol to ValidInstructionTypesEnum and VALID_SYSTEM_INSTRUCTION_TYPES
  • Once validation passes, the WalletConnectDefiCustomTx memo classifies the tx as TransactionType.CustomTx, which wallet-platform already handles for every other DeFi protocol — no WP code change needed

Tests

  • getInstructionType returns 'WithdrawSol' for a stake-pool WithdrawSol instruction (built via StakePoolInstruction.withdrawSol from @solana/spl-stake-pool)
  • validateIntructionTypes accepts a realistic JPool unstake set (SetComputeUnitLimit + SetPriorityFee + Approve + WithdrawSol + memo)
  • getTransactionType classifies that set as TransactionType.CustomTx (numeric enum 31)
  • Full module suite: 721 passing, 0 failing

Safety

The allowlist is a classification gate, not the security boundary: customTx keeps hasUnvalidatedData=true (2nd-admin approval), Narval's review flow, and on-chain program constraints (WithdrawSol burns pool tokens owned by the signer; cannot move funds the wallet doesn't own). Same risk class as the already-allowlisted DepositSol / WithdrawStake / MintTo.

Rollout

Cut a new @bitgo-beta/sdk-coin-sol release → bump in bitgo-microservices (WP pins 7.6.4-beta.618) → deploy WP.

Ticket: DEFI-887

🤖 This PR was generated with pi

JPool (JSOL) unstaking transactions sent via WalletConnect customTx intents
failed with NotSupported because the SPL Stake Pool program's WithdrawSol
instruction (discriminator 16) was missing from the SDK instruction
allowlist. Add it to ValidInstructionTypesEnum and
VALID_SYSTEM_INSTRUCTION_TYPES so these transactions validate and classify
as CustomTx like other DeFi protocol instructions.

Ticket: DEFI-887
@linear-code

linear-code Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

DEFI-887

@mullapudipruthvik
mullapudipruthvik marked this pull request as ready for review September 15, 2026 15:59
@mullapudipruthvik
mullapudipruthvik requested a review from a team as a code owner September 15, 2026 15:59
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

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

Successfully merging this pull request may close these issues.

1 participant