0xMiden / 0xMiden/protocol

`create_p2id_note` should take `Address` as parameter (or should it?)

Offen
#1,837 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
132
Forks
167
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
110

Beschreibung

Three options:
1. `create_p2id_note` should take `Address` as parameter, or
2. we add a new `create_p2addr_note` function to live alongside `create_p2id_note`, or this option but also
3. remove `create_p2id_note` in favor of `create_p2addr_note`

Option 1.'s naming is confusing, so I would favor 2 or 3.

**Q1**: is `p2id` is useful once we have `p2addr`?
**A1**: (glossing over the `AddressInterface` part) I think the answer is "yes, but": sending public notes to public accounts doesn't need encryption or variable tag lengths, and *could* be achieved by `create_p2id_note`. But, having both functions will create more confusion than good imo.

**Q2**: Assuming we deprecate `create_p2id_note` in favor of `create_p2addr_note`, how does the sender obtain `Address` for a public account that hasn't published their `AccountId`?
**A2**: We need to construct some default `Address` based on the `AccountId`. We can choose some good defaults for public accounts:
- the default `tag_len` is based on whether the note is private/public, not the account, so we need a new default value based on the privacy of the account
- `None` for encryption key (once https://github.com/0xMiden/miden-base/issues/1741 lands)
- `AddressInterface::Unspecified` for the interface?

---

Regardless of whether we deprecate `create_p2id_note` or not, I would suggest that for now, we simply proceed with option 2. It will be a non-breaking change, and can be a patch release to address https://github.com/0xMiden/miden-private-transport/issues/23.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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