Open tdelabro opened 4 days ago
Thanks for the PR.
Since the quote id being a uuid is an implementation choice and not something that is defined in the NUTs we cannot enforce or expect a mint to return and a uuid in the wallet. However, maybe for some of the reasons you stated above it would be worth using the uuid type internally for the Mint
and enforcing it there. Internal types like MintQuote
, MeltQuote
could use the uuid type and then types like MeltQuoteBolt11Response
would have to stay string.
What do you think?
Description
This PR changes the type of mint and melt quote Ids to Uuid rather than
String
. It required changes in some field types along with some trait signatures.It will improve the code security by manipulating check Uuid, instead of string that can be anything. It will also improve performances as Uuid fit on less memory [u8; 16] than its string representation. Same for database. It also avoids some memory allocation by being
Copy
. So no need to clone. It also avoids mixing different types intoString
. Eg. In nut17 there was a part where both PublicKeys and Uuid were represented as the same typeString
and fed to the same method. This is really error prone and should be avoided.Notes to the reviewers
I did not write the migration to modify the Ids of the tables in the different database from string to uuid/bytes or whatever is the underlying representation. Can you do it as you are more familiar with the multiple database supported and the way to write and test those migrations.
Suggested CHANGELOG Updates
CHANGED: use uuid as identifier for mint and melt quotes
Checklist
just final-check
before committing