0xMiden / 0xMiden/protocol

Make `NoteConsumptionChecker` bundle-aware

未關閉
#3,710 4 則留言 1 個 reaction 已指派 1 人 已被 @Fumuran 認領 在 GitHub 檢視
fees standards
主要語言
Rust
星號
132
分支
167
平均合併
1 天 23 小時
30 天內合併 PR
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 摘要。