fix(wallet): migrate legacy Solana wallet without silently changing the active address
Summary
Franklin installations can contain both the legacy Solana wallet record, ~/.blockrun/solana-wallet.json, and the canonical session file, ~/.blockrun/.solana-session.
In the SDK bundled through Franklin 3.35.5 and earlier (@blockrun/[email protected]), startup scanned ~/.*/solana-wallet.json files and selected the newest candidate. This included the legacy Franklin JSON file.
Starting with Franklin 3.35.6 (bundling @blockrun/[email protected], also used by 3.38.0), wallet selection was intentionally tightened: normal startup now selects only SOLANA_WALLET_KEY, then ~/.blockrun/.solana-session, then creates a new wallet. The legacy JSON file is no longer selected.
This security correction can expose an invalid/stale canonical session, or make a customer appear to switch away from their historical Franklin address after upgrade. The issue is independent of any particular third-party wallet provider.
Expected
Upgrading Franklin must not silently change the active Solana wallet when a valid legacy Franklin wallet exists. No private key should be exposed to support or telemetry.
Proposed recovery / migration behavior
- Inspect both canonical session and legacy Franklin wallet locally.
- Derive only public addresses; never log or transmit private keys.
- If canonical session is invalid and legacy wallet is valid, offer safe recovery to the legacy wallet.
- If both are valid but differ, show both public addresses and require explicit customer selection.
- Back up before changing the canonical session.
- Persist non-secret provenance metadata (created by Franklin vs. migrated legacy wallet) for future support.
Acceptance criteria
- Regression tests cover installations with only legacy JSON, only canonical session, invalid canonical + valid legacy, and two valid but different wallets.
- UI/CLI recovery does not require customers to run shell commands or share wallet files/private keys.
- Active-wallet selection is deterministic and visible through a non-secret source label.
Notes
The SDK selection behavior changed in Franklin 3.35.6; customers may first notice it on a later upgrade such as 3.38.0 because that release still bundles the newer SDK.
Triaged: confirmed real. Since 3.15.64 the agent reads .solana-session first and only falls back to the legacy solana-wallet.json when the canonical file is missing, and the bundled SDK no longer auto-selects the legacy file — but there is no migration/recovery UX when both exist and differ. Keeping this open as a tracked enhancement; the proposed behavior (derive public addresses only, show both, require explicit choice, never log keys) is the right shape.