0xMiden / 0xMiden/protocol

Make `NoteConsumptionChecker` bundle-aware

Đang mở
#3,710 4 bình luận 1 reaction 1 người được giao Được @Fumuran nhận Xem trên GitHub
fees standards
Ngôn ngữ chính
Rust
Star
132
Fork
167
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
110

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.