Skip to content
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

feat: use Uuid as mint and melt quote ids #469

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tdelabro
Copy link
Contributor

@tdelabro tdelabro commented Nov 22, 2024

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 into String. Eg. In nut17 there was a part where both PublicKeys and Uuid were represented as the same type String 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

@thesimplekid
Copy link
Collaborator

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?

@tdelabro tdelabro force-pushed the use-uuid-for-quote-id branch 2 times, most recently from af29c43 to 42def59 Compare November 25, 2024 18:22
@tdelabro
Copy link
Contributor Author

@thesimplekid can you find time to review this this week?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants