Repository navigation
fix: fixed skipping metadata write on toprf creation retry - #10419
Conversation
| // Mark migration as complete since this new backup was created with the new data format (dataType) | ||
| this.#setMigrationVersion(SeedlessOnboardingMigrationVersion.V1); | ||
|
|
||
| // Persist local backup state after all operations succeed. | ||
| this.#filterDupesAndUpdateSocialBackupsMetadata({ | ||
| keyringId, | ||
| data: seedPhrase, | ||
| type: secretMetadata.type, | ||
| }); | ||
| }; | ||
|
|
There was a problem hiding this comment.
Missing test for the exact bug scenario. This defers local state until after everything succeeds but there's no test that simulates: remote metadata writes → OPRF/vault creation fails → retry with a new TOPRF key → assert remote write happens again. That's the specific failure this fixes and it should have a dedicated test.
| @@ -1789,7 +1810,16 @@ export class SeedlessOnboardingController< | |||
| data, | |||
| type, | |||
| }; | |||
There was a problem hiding this comment.
When skipStatePersist: true, we call persistMetadataFn directly and skip #withPersistedSecretMetadataBackupsState entirely. Does that wrapper do anything beyond persisting state: locking, error normalization, cleanup? If so, we're silently skipping it.
There was a problem hiding this comment.
#withPersistedSecretMetadataBackupsState this only store the secret hash to the state.
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
|
Added |
|
Removed |
## Explanation Prepare monorepo release **1285.0.0** for `@metamask/transaction-controller@72.0.0` and all **19 direct workspace dependents**. `perps-controller` is now included for the consumer-facing HIP-3 snapshot fix merged in MetaMask#10429, not merely for its development dependencies; `earn-controller` also has an existing production dependency bump. This branch incorporates current `main`, including MetaMask#10429 and MetaMask#10419. No source-code changes are introduced by this PR relative to current `main`. ### Versions in this release | Package | Version | Rationale | | --- | --- | --- | | `transaction-controller` | **72.0.0** | Breaking revert of approval-time sponsorship/signing hooks (MetaMask#10420) | | `subscription-controller` | **10.0.0** | Existing Unreleased breaking subscription type changes (MetaMask#10305, MetaMask#10416) | | `wallet` | **15.0.0** | Its exported default instance/state types expose the breaking subscription and transaction-controller changes | | `transaction-pay-controller` | **29.2.0** | Additional supported pay-strategy flows and server-quote behavior (MetaMask#10342) | | `assets-controller` | 16.1.1 | Dependency updates and previously merged fixes | | `assets-controllers` | 112.0.3 | Dependency updates | | `bridge-controller` | 81.3.1 | Dependency updates | | `bridge-status-controller` | 76.3.1 | Dependency updates | | `client-utils` | 3.0.3 | Dependency update | | `earn-controller` | 13.0.1 | Existing production `account-tree-controller` bump; transaction-controller is dev-only here | | `eip-5792-middleware` | 4.0.1 | Dependency updates | | `gator-permissions-controller` | 6.0.1 | Dependency updates | | `money-account-utils` | 2.0.1 | Dependency updates | | `network-enablement-controller` | 7.0.1 | Dependency updates | | `perps-controller` | **18.0.1** | Fix Terminal v3 HIP-3 snapshot validation (MetaMask#10429); patch bump | | `phishing-controller` | 18.1.1 | Dependency update | | `profile-metrics-controller` | 5.1.1 | Dependency updates | | `shield-controller` | 7.0.2 | Dependency updates | | `smart-transactions-controller` | 27.0.2 | Dependency updates | | `user-operation-controller` | 42.0.1 | Dependency updates | Dependent packages have their Unreleased changelog entries moved to their new release sections. Additional *non-released* transitive dependents receive compatible workspace ranges (`money-account-upgrade-controller`, `network-connection-banner-controller`, `signature-controller`, and unpublished `wallet-cli`); the three published packages receive Unreleased dependency changelog entries. `yarn.lock` is synchronized. Changes to `perps-controller`'s development dependencies are intentionally omitted from its changelog. **Coordination before merge:** The transaction-controller hook revert and the subscription-controller's existing breaking type changes affect consumers. Confirm Extension and Mobile migrations before publishing these three major versions. This is a release candidate, not a published release. ## References - Breaking revert: MetaMask#10420; original published API: MetaMask#10109. - EIP-7702 performance change: MetaMask#10397. - Perps HIP-3 snapshot fix: MetaMask#10429. - Subscription breaking changes: MetaMask#10305, MetaMask#10416. - Client adoption PRs to coordinate: [Extension #46060](MetaMask/metamask-extension#46060), [Mobile #35754](MetaMask/metamask-mobile#35754). They adopt the removed hooks; they are **not** migrations for this revert. ## Validation - `yarn build` - `yarn workspace @metamask/transaction-controller run test` - `yarn workspace @metamask/subscription-controller run test` - `yarn workspace @metamask/transaction-pay-controller run test` - `yarn workspace @metamask/wallet run test` - `yarn workspace @metamask/perps-controller run test` (after incorporating MetaMask#10429) - `yarn changelog:validate`, `yarn constraints`, `yarn install --immutable`, `yarn dedupe --check` - `yarn lint:dependencies` (after removing stale generated bridge-controller `dist` output) - `git diff --check` ## Checklist - [x] Changelogs describe the breaking changes in transaction-controller, subscription-controller, and wallet. - [x] Direct workspace dependents are included, with perps now having a consumer-facing fix (MetaMask#10429). - [ ] Extension and Mobile consumers have been coordinated for these breaking changes before merging this release. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **High Risk** > Publishes breaking majors for transaction signing/sponsorship and subscription types that require coordinated Extension/Mobile migrations before consumers upgrade `@metamask/wallet` or `@metamask/transaction-controller`. > > **Overview** > Prepares **monorepo release 1285.0.0** by bumping package versions, moving Unreleased changelog notes into release sections, aligning workspace dependency ranges, and refreshing `yarn.lock`. There are **no application source edits** in this diff—only release metadata for work already on `main`. > > The release centers on **`@metamask/transaction-controller@72.0.0`**, which **reverts** the approval-time `isSponsored` / `shouldSign` hooks in favor of metadata-driven **`isGasFeeSponsored`** and **`isExternalSign`**, drops related exports and `isGasFeeSponsoredAvailable`, and again **requires** a `hooks` object (use `hooks: {}` when empty). **`@metamask/subscription-controller@10.0.0`** ships existing breaking subscription/payment-token type changes (optional period fields, vault-share detection via `isVaultShareToken`, crypto payment failure types). **`@metamask/wallet@15.0.0`** bumps those majors plus related dependents. > > Nineteen direct workspace dependents get compatible semver bumps (mostly patch dependency realignments to `@metamask/transaction-controller@^72.0.0`). Notable published notes include **`@metamask/perps-controller@18.0.1`** (HIP-3 Terminal snapshot validation fix) and **`@metamask/transaction-pay-controller@29.2.0`** (server pay-strategy quoting/submit fixes). Unpublished/transitive packages (`wallet-cli`, `money-account-upgrade-controller`, etc.) get range updates without always cutting new versions. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6017d49. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Baptiste Marchand <75846779+baptiste-marchand@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.
type=text Section must contain non-placeholder prose.
type=changelog Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
comment but do not block the PR.
Sections without a directive are checked for structural presence only.
-->
## **Description**
Social-login users could finish wallet creation but fail to restore on
another device with:
```text
SeedlessOnboardingController - Primary secret data must be of type mnemonic.
```
That happened when primary SRP metadata was written remotely but OPRF
share persistence failed. A local SRP hash was already committed, so a
retry skipped the remote backup and left incomplete primary SRP data on
the server.
This PR upgrades `@metamask/seedless-onboarding-controller` from
`10.1.1` to `11.0.1`, which fixes incomplete TOPRF backup retry behavior
(`skipStatePersist` / `VaultAlreadyExists`). Jest is updated to
transpile the package (ESM).
Core fix:
[MetaMask/core#10419](MetaMask/core#10419).
<!-- mms-check: type=text required=true -->
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Fixed an issue that could prevent social-login users
from restoring their wallet on a new device.
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes:
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
```gherkin
Feature: Social login wallet creation after seedless controller 11.0.1
Scenario: User creates a new wallet with social login
Given the app is freshly installed on Android or iOS
When the user completes social login (Google or Apple) and creates a password
Then wallet creation succeeds and the user reaches home
```
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
https://github.com/user-attachments/assets/10c50e63-7c90-4ce2-b70a-5aae75e257b1
https://github.com/user-attachments/assets/d3e9f940-a989-405d-9ee3-3306b6a06421
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches seedless wallet creation/restore and remote SRP backup
behavior; dependency-only but security- and data-sensitive for
social-login users.
>
> **Overview**
> Bumps **`@metamask/seedless-onboarding-controller`** from **10.1.1**
to **11.0.1** (dependency + Yarn resolution + lockfile). That release
fixes incomplete TOPRF/primary SRP remote backup when OPRF share
persistence fails and a retry would otherwise skip re-backup—addressing
social-login restore failures (`Primary secret data must be of type
mnemonic`).
>
> **Jest** now transpiles `@metamask/seedless-onboarding-controller` so
unit tests can load the package’s ESM build. No mobile app or onboarding
UI changes in this diff.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
385b5fd. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Explanation
createToprfKeyAndBackupSeedPhrasecan be retried after a partial failure. Previously, the first attempt could persist backup metadata locally before the remaining TOPRF and vault operations completed. A token-refresh retry would then see the local metadata and skip the remote metadata write.This change:
VaultAlreadyExistswhen a vault already exists, preventing duplicate TOPRF key creation and backup attempts.Remote orphan cleanup and rollback remain out of scope for this minimal hotfix.
References
Checklist
Note
High Risk
Changes ordering of local vs remote backup metadata during seedless vault onboarding and TOPRF writes, which are security- and recovery-critical paths.
Overview
Fixes a partial-failure bug in
createToprfKeyAndBackupSeedPhrase: the first attempt could write remote backup metadata and persist localsocialBackupsMetadatabefore OPRF key persistence and vault creation finished. A token-refresh retry then treated the backup as already done and skipped the remote metadata write, leaving inconsistent TOPRF backup state.The flow now calls
#encryptAndStoreSecretDatawithskipStatePersist: trueso only the remote store is updated during the in-flight operation, then#filterDupesAndUpdateSocialBackupsMetadataruns after vault creation and migration marking succeed.#encryptAndStoreSecretDatareturnsSecretMetadataand supports optionalskipStatePersist; duplicate-backup short-circuit still returns metadata without re-uploading.VaultAlreadyExistsis thrown whenstate.vaultis already set, blocking duplicate TOPRF key / initial backup calls. Changelog and tests cover vault-creation failure retries, token-refresh retries (expecting a second remote write), and duplicate backup behavior.Reviewed by Cursor Bugbot for commit f54a681. Bugbot is set up for automated code reviews on this repo. Configure here.