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

Đang mở
#369 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1
Fork
21
Merge trung bình
12 giờ 14 phút
Pull request đã merge (30 ngày)
41

Mô tả

### 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Xem xét phương thức MidenDatabase.open() và xử lý lỗi xung quanh. Vấn đề là sau khi di chuyển Dexie từ phiên bản 2 lên 5, việc giải tuần tự hóa các hàng cũ (cụ thể là khóa công khai) thất bại. Kiểm tra logic tuần tự hóa/giải tuần tự hóa cho dữ liệu tài khoản. Bản sửa lỗi có thể liên quan đến việc bắt lỗi lưu trữ rộng hơn trong quá trình mở và kích hoạt xóa kho lưu trữ, tương tự như xử lý hạ cấp trong issue #355. Kiểm tra bằng cách tạo một kho lưu trữ với phiên bản 0.15.9, sau đó thử mở nó với phiên bản 0.16.0-rc.7.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
databases
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.