Skip to content

fix: attach signers to Solana sweep transaction#70

Merged
1bcMax merged 1 commit intomainfrom
fix/solana-sweep-missing-signatures
Mar 4, 2026
Merged

fix: attach signers to Solana sweep transaction#70
1bcMax merged 1 commit intomainfrom
fix/solana-sweep-missing-signatures

Conversation

@1bcMax
Copy link
Member

@1bcMax 1bcMax commented Mar 4, 2026

Summary

  • signTransactionMessageWithSigners was producing unsigned transactions because only plain Address strings were used in instruction account metas — no signer objects were attached
  • Added addSignersToTransactionMessage([newSigner, oldSigner], txMessage) before signing so both the fee payer (new wallet) and token transfer authority (old wallet) are properly bound
  • Fixes: "Transaction is missing signatures for addresses" error on /wallet migrate-solana

Test plan

  • Run /wallet migrate-solana with a user that has USDC in the old (legacy secp256k1) wallet
  • Verify the transaction is signed by both old and new wallet addresses
  • Verify USDC is swept from old wallet to new SLIP-10 wallet

Summary by CodeRabbit

  • Refactor
    • Improved wallet sweep transaction handling for enhanced reliability during the signing process.

signTransactionMessageWithSigners was producing unsigned transactions
because only plain Address strings were in the instruction accounts —
no actual signer objects were attached. Use addSignersToTransactionMessage
to bind both newSigner and oldSigner before signing.
@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

The sweepSolanaWallet function in src/solana-sweep.ts has been modified to augment the transaction message with both the new signer and old signer via addSignersToTransactionMessage before performing the signing operation, rather than signing the original transaction message directly.

Changes

Cohort / File(s) Summary
Signing Flow Update
src/solana-sweep.ts
Modified the signing step in sweepSolanaWallet to attach both newSigner and oldSigner to the transaction message before signing, ensuring both signers are explicitly available to the signer function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: attaching signers to the Solana sweep transaction to fix the missing signatures issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/solana-sweep-missing-signatures

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/solana-sweep.ts`:
- Around line 249-255: The file fails CI due to Prettier formatting; run the
formatter and commit the changes (e.g., run npx prettier --write) to normalize
spacing/line breaks around the addSignersToTransactionMessage and
signTransactionMessageWithSigners call site; after formatting, verify the
txMessageWithSigners variable and adjacent comments remain unchanged and then
stage and push the formatted file to clear the CI warning.

ℹ️ Review info
Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a53da588-c199-4a9a-bf6e-2165cf4f53cd

📥 Commits

Reviewing files that changed from the base of the PR and between 288c689 and d8814f2.

📒 Files selected for processing (1)
  • src/solana-sweep.ts

Comment on lines +249 to +255
// Attach both signers so signTransactionMessageWithSigners can find them
const txMessageWithSigners = addSignersToTransactionMessage(
[newSigner, oldSigner],
txMessage,
);

const signedTx = await signTransactionMessageWithSigners(txMessageWithSigners);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

CI warning: format this file with Prettier.

The pipeline reports formatting drift in this file. Please run npx prettier --write src/solana-sweep.ts to clear CI.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/solana-sweep.ts` around lines 249 - 255, The file fails CI due to
Prettier formatting; run the formatter and commit the changes (e.g., run npx
prettier --write) to normalize spacing/line breaks around the
addSignersToTransactionMessage and signTransactionMessageWithSigners call site;
after formatting, verify the txMessageWithSigners variable and adjacent comments
remain unchanged and then stage and push the formatted file to clear the CI
warning.

@1bcMax 1bcMax merged commit 5ac1b6b into main Mar 4, 2026
3 of 4 checks passed
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