fix(wallet): say so when Franklin stopped using the wallet holding your USDC - #167
Merged
Conversation
…ur USDC Closes #119. 3.35.6 tightened SDK wallet selection — SOLANA_WALLET_KEY, then ~/.blockrun/.solana-session, then create — and stopped selecting the legacy ~/.blockrun/solana-wallet.json. That was a deliberate security fix and it stays. What it left behind is a silent address change. The SDK does print a migration notice, but only when it CREATES a wallet. The install that actually hurts already has a .solana-session, so nothing is created, nothing is printed, and the user is simply spending from a different address than the one holding their USDC. Money looks missing and there is no message anywhere explaining why. Detection is read-only and side-effect free. It derives the active address from the session key rather than calling getOrCreateSolanaWallet(), which would create the very wallet a diagnostic is trying to report on, and it compares against addresses the SDK derives from each discovered key rather than the `address` field a file claims. A file naming someone else's address while holding the active key is not a divergence, and there is a test for that. `franklin doctor` reports it. `franklin wallet-adopt <address>` switches, and only when named: the complaint is that the active wallet changed without anyone asking, so the remedy must not do the same in the other direction. importSolanaWallet backs up the current session before replacing it. No secret key is printed or logged on any path. sensitive-paths.ts described the legacy file as { address, private_key }. It is camelCase — the shape context.ts and the SDK scanner both read. A wrong comment next to key handling is how the next parser gets written wrong. CHANGELOG 3.46.0 also picks up #140, which merged after that entry was written. 754 local tests pass; the new suite runs against a temp HOME and asserts it is not the real one before writing anything. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #119.
3.35.6 tightened SDK wallet selection and stopped selecting the legacy
~/.blockrun/solana-wallet.json. That was a deliberate security fix and it stays. What it left behind is a silent address change.The SDK prints a migration notice — but only when it creates a wallet. The install that hurts already has a
.solana-session, so nothing is created, nothing is printed, and the user spends from a different address than the one holding their USDC. Money looks missing with no message anywhere explaining why.What this adds
src/wallet/solana-migration.ts) — read-only and side-effect free.franklin doctorreports the divergence with both public addresses.franklin wallet-adopt <address>switches, and only when named.Two things it deliberately does not do
It does not call
getOrCreateSolanaWallet(). That creates a wallet as a side effect — the exact wrong move inside a diagnostic trying to tell you which wallet you already have. The active address is derived from the session key directly.It does not adopt anything on its own. The complaint behind #119 is that the active wallet changed without anyone asking; the remedy must not do the same in the other direction.
importSolanaWalletbacks up the current session before replacing it.Trust
Addresses are derived from keys, never read from a file's
addressfield. A legacy file naming someone else's address while holding the active key is not a divergence — there is a test for that. No secret key is printed or logged on any path, asserted in the tests.Also:
sensitive-paths.tsdescribed the legacy file as{ address, private_key }. It is camelCase — the shapecontext.tsand the SDK scanner both read. A wrong comment next to key handling is how the next parser gets written wrong.CHANGELOG 3.46.0 also picks up #140, which merged after that entry was written.
754 local tests pass. The new suite runs against a temp HOME and asserts it is not the real one before writing anything.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h