[@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
- 主要语言
- TypeScript
- 星标
- 1
- 派生
- 21
- 平均合并
- 12 小时 14 分钟
- 30 天内合并 PR
- 41
描述
### 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.
贡献指南
调研方向
查看 MidenDatabase.open() 方法及其周围的错误处理。问题在于,在 Dexie 从版本 2 迁移到版本 5 之后,旧行(特别是公钥)的反序列化失败。检查账户数据的序列化/反序列化逻辑。修复可能涉及在打开时捕获更广泛的存储错误并触发存储擦除,类似于 issue #355 中的降级处理。测试方法:使用版本 0.15.9 创建一个存储,然后尝试使用 0.16.0-rc.7 打开它。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100