0xMiden / 0xMiden/web-sdk

[@miden-sdk/miden-sdk] Upgrading 0.15.9 -> 0.16.0-rc.x on an existing store fails to deserialize and the client never starts

Ouverte
#369 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
1
Forks
21
Merge moyen
12 h 14 min
PR mergées (30 j)
41

Description

### Packages versions

@miden-sdk/miden-sdk: 0.15.9 -> 0.16.0-rc.7

### Bug description

Upgrading the client on an origin that already has a store leaves the app unable to start. `MidenDatabase.open()` throws before any network call:

```
Failed to create client: storage error: failed to deserialize data from the store: invalid value: Invalid public key
```

Nothing recovers from this. The user has to clear site data by hand, and there is no message telling them that is what is needed.

### Steps to reproduce

1. On a clean origin, run 0.15.9 and let it create an account, so the store has rows.
2. Load 0.16.0-rc.7 on the same origin.
3. `createTestnet()` fails with the error above.

With the same origin cleared first, rc.7 gets past this and fails at the RPC instead, which is the version mismatch you would expect against the current testnet:

```
accept header validation failed: server rejected request (client version: 0.16.0-rc.4, genesis commitment: none)
```

So the storage error is specific to having 0.15.9 rows present, not to rc.7 being unable to reach the network.

### Why the downgrade fix does not cover it

#355 catches `VersionError` around `dexie.open()` and wipes. That path is not reached here. rc.7 declares Dexie versions up to 5 while 0.15.9 stops at 2, so opening with the newer client is an upgrade, Dexie runs its own migration and nothing throws `VersionError`. What fails afterwards is reading 0.15.9 era rows with the newer deserializer.

### Notes

This is the direction most people will take when testnet moves to 0.16, so it seems worth handling as well as the downgrade. Widening the catch around `open()` to any store error and wiping would cover both, at the cost of dropping accounts and notes, which is already what the downgrade path does.

I hit this while building an app against 0.15.9, and again on our own deployment after testing rc.7 on the same origin, which bricked the 0.15.9 app until site data was cleared.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Examinez la méthode MidenDatabase.open() et la gestion des erreurs environnante. Le problème est qu'après une migration Dexie de la version 2 à la 5, la désérialisation des anciennes lignes (en particulier des clés publiques) échoue. Examinez la logique de sérialisation/désérialisation pour les données de compte. La correction implique probablement d'intercepter une erreur de stockage plus large lors de l'ouverture et de déclencher un effacement du magasin, similaire à la gestion de la rétrogradation dans l'issue #355. Testez en créant un magasin avec la version 0.15.9, puis en essayant de l'ouvrir avec la 0.16.0-rc.7.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
databases
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.