0xMiden / 0xMiden/protocol

Make `NoteConsumptionChecker` bundle-aware

オープン
#3,710 コメント 4 件 リアクション 1 件 担当者 1 名 @Fumuran が担当を希望しています GitHub で見る
fees standards
主要言語
Rust
スター
132
フォーク
167
平均マージ
1日 23時間
マージ済み PR(30日)
110

説明

The `NoteConsumptionChecker` which is used by the network transaction builder searches for a valid set of notes to execute by changing up individual notes in the input note set. As of recently, with the introduction of sponsorship notes for app-level fees, the builder needs to keep track of `(FeatureNote, [SponsorshipNote])`. Whenever the checker reaches an epilogue failure, it tries to build a valid set of executable notes by [starting with an individual note and extending that set one by one](https://github.com/0xMiden/protocol/blob/6ee74e11ec8505bbeded9027618cc2dd02ef4b52/crates/miden-tx/src/executor/notes_checker.rs#L365). Notably, whenever network note fee collection fails for whatever reason, it will fail on the epilogue, as the logic resides in the network auth component.

The problem here is that a feature note that requires sponsorship will always fail execution on its own, and similarly the sponsorship note cannot be executed if not paired with their feature notes or the original network note author (for reclaiming), so these sets always end up empty.
Here's [an example](https://github.com/0xMiden/protocol/compare/igamigo-claude/checker-drops-sponsored-pairs) I got Claude to write. This is the main part:

```rust
/// Writing `F` for a feature note, `S` for the sponsorship bound to it and `S'` for an underfunded
/// one, the cases below are:
///
/// ```text
/// [F0, S0] -> successful {F0, S0} failed {}
/// [F0, S0, F1] -> successful {} failed {F0, S0, F1}
/// [F0, S0, F1, S1'] -> successful {} failed {F0, S0, F1, S1'}
/// ```
```

I think we may want to either make `NoteConsumptionChecker` bundle-aware, where we can atomically test adding a bundle of notes (e.g., the ntx builder could pass a list of bundles of `(FeatureNote, [SponsorshipNote])`), or improve/change the overall heuristics. Maybe there's something to be done for the special case of network notes and the fee collection error. For now I think the ntx builder can probably just do more extensive and manual checks until we have improved the checker.

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

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

評価

この issue はまだ評価されていません。

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

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