0xMiden / 0xMiden/web-sdk

Do not silently overwrite partial blockchain MMR nodes in IndexedDB

オープン
#193 コメント 0 件 リアクション 0 件 担当者 1 名 @juan518munoz が担当を希望しています GitHub で見る
主要言語
TypeScript
スター
1
フォーク
21
平均マージ
12時間 14分
マージ済み PR(30日)
41

説明

The IndexedDB store writes partial blockchain MMR nodes with `bulkPut()`:

- `insertPartialBlockchainNodes()`
- `updatePartialBlockchainNodes()`

`bulkPut()` overwrites an existing row with the same key. This means that if the store already has an authentication node for some MMR index, a later write with the same index but a different value silently replaces it.

These nodes are part of the local `PartialMmr` state. If a buggy or malicious sync path ever tries to write a different value for an already-known node index, the web store should not silently replace the old value.

This is related to #190 and #104, but not the same issue. #190 is about rolling back `AccountSmtForest` after failed writes, while this issue is about rejecting conflicting writes to already-stored `PartialMmr` authentication nodes.

Expected behavior:

- writing the same node index with the same value should be accepted or ignored
- writing the same node index with a different value should return an error
- the old value should remain stored

Suggested fix: replace `bulkPut()` with insert-if-missing plus an equality check on conflicts.

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

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

調査の方向性

Look at the IndexedDB store methods `insertPartialBlockchainNodes()` and `updatePartialBlockchainNodes()` that use `bulkPut()`. Understand the `PartialMmr` state and how authentication nodes are keyed by MMR index. Replace `bulkPut()` with logic that checks for existing keys and compares values, throwing an error on mismatch. Test by simulating conflicting writes to ensure the old value is preserved.

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

評価

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

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

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