0xMiden / 0xMiden/feedback

Consume imported note files immediately

未關閉
#123 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
wallet
主要語言
沒有語言資料
星號
1
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

### Feature description

Currently, the import private note feature only adds the note file to the web client db. The consumption of the note is handled separately. This leads to a few observable behaviors:
- The note file being added to the client db does not guarantee that the note will appear in the wallet as claimable. The wallet polls the `getClaimableNotes` endpoint for the note and marks the note file as "verified".
- If a note is not claimable by the account, the `getClaimableNotes` polling will timeout after 20 seconds and a "failed import" screen is shown
- Malformed .mno files or other file types are properly rejected, and an console error is logged with a detailed error from the web client

For the adapter `importPrivateNote` endpoint:
- The error for malformed .mno files or other file types is not propagated through the adapter endpoint, which shows a generic error message (see https://github.com/0xMiden/feedback/issues/109)
- `importPrivateNote` currently only adds the note to the client db. It then relies on the wallet to handle the consumption
- Therefore, the adapter will return a success response as long as the note is accepted into the client db, regardless of claimability
- I think this is a major point of confusion, as users likely expect `importPrivateNote` to consume the note

If the wallet attempts to claim the note before returning a response, I believe most of these issues will be resolved. Specifically, the import private note flow can do the following:
- add the note file to the client db
- (if necessary) poll for the note to appear as claimable
- create/execute/prove the consume transaction (we can check whether the note is consumable here)
- submit and apply the transaction

The adapter endpoint can wait for at least the prove step before returning a response, so that the user receives a response that more accurately portrays the consumability of the imported note, rather than the current indication of it being added to the client db.

As an extension, the adapter could provide controls over whether the consume transaction is automatically submitted to the node, but that is out of scope.

### Why is this feature needed?

_No response_

貢獻指南

開啟貢獻指南

研究方向

該 issue 描述了適配器端點 importPrivateNote 及其與 Web 客戶端資料庫和錢包輪詢的互動。首先定位適配器端點程式碼和 getClaimableNotes 輪詢邏輯。理解 note 的消費流程和交易證明。檢查圍繞 note 導入和消費的現有測試以了解目前行為。'Done' 意味著該端點等待證明步驟並返回關於 note 可消費性的準確回應。

由索引模型根據 Issue 內容生成。

評估

領域
api, backend
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。