feat: craft the legacy wallet upgrade from the wallet's actual state; 0.19.0 - #21
Merged
Merged
Conversation
… 0.19.0 The kit cannot connect to a pre-1.0 wallet, but it can now build the one transaction such a wallet needs. New kit methods: - inspectLegacyWallet(id): code hash, status (vulnerable / legacy / current / unknown), storage cohort, which of the instance / current-code / target-code entries are archived, and a plain recommendation. Read-only. - buildLegacyUpgradeTx(id): update_contract_code(<legacy-line target>), refused for wallets not on a pre-1.0 build; restores archived entries first when restoreSource is configured, else throws RESTORE_REQUIRED with guidance. - buildLegacyMigrateTx(id, keys): migrate_signers for the bare cohort. - signLegacyUpgradeTx(tx, id, signer?): signs the wallet's auth entry with an existing passkey or Ed25519 signer without a connected wallet; the entry must root at exactly the transaction's own call on this wallet with no sub-invocations. Records the mainnet upload of the legacy-line target (tx 501bd5d5…) in the docs. Cuts CHANGELOG 0.19.0 and bumps the package version. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The signing path can authorize unintended wallet-admin calls, and restoration and cohort tracking have correctness gaps.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds tooling to inspect and upgrade pre-1.0 wallets from their on-chain state.
Changes:
- Adds legacy wallet inspection, upgrade, migration, restoration, and signing helpers.
- Adds 11 focused tests.
- Releases version 0.19.0 and documents the mainnet upgrade target.
File summaries
| File | Description |
|---|---|
src/version.ts |
Updates the generated version. |
src/kit/legacy-ops.ts |
Implements legacy wallet operations. |
src/kit/legacy-ops.test.ts |
Tests the new helpers. |
src/kit.ts |
Exposes helpers through PasskeyKit. |
src/index.ts |
Exports legacy inspection types and utilities. |
SECURITY.md |
Records upgrade tooling and mainnet upload. |
package.json |
Bumps the package version. |
docs/releasing.md |
Updates release documentation. |
docs/legacy-wallet-upgrade.md |
Documents the SDK upgrade workflow. |
CHANGELOG.md |
Adds the 0.19.0 release notes. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+101
to
+103
| if (LEGACY_WALLET_WASM_HASHES.includes(hash)) { | ||
| return { status: "legacy", cohort: "wrapped" }; | ||
| } |
Comment on lines
+356
to
+360
| const ok = | ||
| expected !== undefined && | ||
| actual !== undefined && | ||
| root.subInvocations().length === 0 && | ||
| Address.fromScAddress(actual.contractAddress()).toString() === contractId && |
Comment on lines
+968
to
+970
| let tx = await build(); | ||
| const simulation = tx.simulation; | ||
| if (simulation && Api.isSimulationRestore(simulation)) { |
Comment on lines
+91
to
+94
| const hash = wasmHash.toLowerCase(); | ||
| if (acceptedWasmHashes.includes(hash)) { | ||
| return { status: "current", cohort: null }; | ||
| } |
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.
What
The kit cannot connect to a pre-1.0 wallet (
LegacyWalletError, #19), but it can now build the one transaction such a wallet needs, from the wallet's actual on-chain state.inspectLegacyWallet(id)— code hash, status (vulnerable/legacy/current/unknown), storage cohort, which of the instance / current-code / target-code entries are archived, and a plain recommendation. Read-only.buildLegacyUpgradeTx(id)—update_contract_code(<legacy-line target>); refused for wallets not on a pre-1.0 build; restores archived entries first whenrestoreSourceis configured, else throwsRESTORE_REQUIREDwith guidance.buildLegacyMigrateTx(id, keys)—migrate_signersfor the bare cohort.signLegacyUpgradeTx(tx, id, signer?)— signs the wallet's auth entry with an existing passkey or Ed25519 signer without a connected wallet. The entry must root at exactly the transaction's own call on this wallet with no sub-invocations.Also records the mainnet upload of the legacy-line target (tx
501bd5d5…), cuts CHANGELOG0.19.0, and bumps the package version. Bindings are unchanged (verify:bindingspasses against the canonical v1 WASM).Tests
11 new tests: classification, inspection against mocked ledger state, the exact shape of both transactions, and signing with a real Ed25519 signer through the real
signAuthEntriespath (address-bound V2 credentials), plus the refusal of a foreign-rooted entry. Full suite: 360 passing.🤖 Generated with Claude Code