0xMiden / 0xMiden/web-sdk

`latest` on npm is a release candidate the public testnet rejects

オープン
#349 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1
フォーク
21
平均マージ
12時間 14分
マージ済み PR(30日)
41

説明

Installing the SDK with the default tag gives a version that the public testnet will not accept, so the first call fails for anyone following the README.

```
npm dist-tags @miden-sdk/miden-sdk
latest -> 0.16.0-rc.5
next -> 0.16.0-alpha.2
```

Latest stable is 0.15.9.

### Repro

```bash
pnpm add @miden-sdk/miden-sdk # installs 0.16.0-rc.5
```

```js
const client = await MidenClient.createTestnet();
```

```
Failed to ensure genesis in place: RPC error: accept header validation failed:
server rejected request - please check your version and network settings
(client version: 0.16.0-rc.3, genesis commitment: none)
```

### The obvious fix leads into a second problem

Downgrading to 0.15.9 is the natural response, but the store left behind by the rc build then breaks the stable client:

```
failed to sync state: storage error: database-related non-query error:
failed to deserialize (failed to get sync height):
invalid type: unit value, expected struct SyncHeightIdxdbObject
```

`ensureClientVersion` in `crates/idxdb-store/src/js/schema.js` only resets the store when the incoming version is strictly greater, so a downgrade takes the early return and keeps the incompatible data:

```js
if (sameMajorMinor || !semver.gt(clientVersion, storedVersion)) {
await this.persistClientVersion(clientVersion);
return;
}
```

With `storedVersion` 0.16.0-rc.3 and `clientVersion` 0.15.9, `sameMajorMinor` is false and `semver.gt` is false, so the condition holds and no reset happens. The version marker is overwritten while the old data stays. Going the other way the reset does fire, so the protection is one directional.

This is the same function as #158 and #287, but a different aspect of it, so I filed it here rather than commenting there.

### Suggestion

Point `latest` at 0.15.9 and keep the rc under its own tag. That alone removes the path that leads into the store problem. Resetting on any version change rather than only on an increase would also cover the downgrade case, and the deserialization error could mention that the store may be stale.

Environment: macOS, Chrome 152, node 24, pnpm 10.18, testnet.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

The issue is in the npm dist-tags and the store version handling. Start by checking the npm package tags via `npm dist-tags @miden-sdk/miden-sdk`. Look at the `ensureClientVersion` function in `crates/idxdb-store/src/js/schema.js` to understand the version comparison logic. The fix involves updating the npm tag and potentially modifying the version check to handle downgrades. Test by installing the SDK and verifying the testnet connection works with the stable version.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
nodejs, typescript
領域
cli, developer-experience, release
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。