-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add write_as_raw_encoding method to UnifiedAddress #711
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 71.09% // Head: 70.95% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #711 +/- ##
==========================================
- Coverage 71.09% 70.95% -0.14%
==========================================
Files 115 115
Lines 11584 11604 +20
==========================================
- Hits 8236 8234 -2
- Misses 3348 3370 +22
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I'm trying to clean up this code to remove that repetitive match statement, and it seems that hoops have been jumped through to keep My goal is to write down a UA in as compact a format as possible, ideally while being network agnostic. Right now the only way to do this is to encode it for some network, decode it (for the same arbitrary network) as a |
What is the intent of exposing the raw encoding? It is intended that unified addresses are only ever serialized to their string encoding, not the raw byte encoding. |
An example of wanting a binary encoding is for a ZIP 302 Reply-To field (because it is shorter than the string encoding). In this particular case, it's not necessary to encode the network because it is implied by the network of the transaction (since a shielded transaction always commits to the root of a commitment tree). |
@AloeareV can you describe what your specific use case is?
What type are you encoding from? Is it the
We don't want to expose a raw binary encoding of UA receivers anywhere where it might end up being shown to users e.g. as hex (the whole reason for F4Jumble existing is to prevent various kinds of attacks on human-readable UA encodings). So I want to understand the use case here, to better inform how this kind of API should look (or whether it should exist at all). |
Yeah, this is ZIP-302 arbitrary wallet-internal memo stuff. Right now when you send to a UA, only the selected receiver is actually encoded on-chain, meaning that when you restore a wallet from seed there's no way to recover the full UAs that were sent to. Zingolib is experimenting with using the memo field of the change output to solve this, and possibly some other things.. Right now it's just the UA(s) sent to, but the memo is only 511 bytes (plus the Now that I think about it more, I think I could get all the functionality I'm missing just by exposing the unknown receivers in the |
I'm encoding from a zcash_client_backend |
After discussing this further, the correct way forward here is:
|
@daira and I are working on specifying the binary encoding as an update to ZIP 316 this afternoon. |
Adds a
write_as_raw_encoding
method toUnifiedAddress
. Right now,Receiver
s can be read, turned into azcash_address::unified::Address
, and converted to aUnifiedAddress
, but the reverse operation isn't possible.