0xMiden / 0xMiden/protocol

Make `NoteConsumptionChecker` bundle-aware

Offen
#3,710 4 Kommentare 1 Reaktion 1 zugewiesene Person Beansprucht von @Fumuran Auf GitHub ansehen
fees standards
Vorherrschende Sprache
Rust
Sterne
132
Forks
167
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
110

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.