Adds API route for retrieving quote IDs#2
Conversation
| pub struct QuotesSharesResponse { | ||
| /// Share hash -> quote ID mapping | ||
| pub quote_ids: HashMap<String, String>, | ||
| } |
There was a problem hiding this comment.
Moved these out of cdk-axum since the wallet needed the objects as well and it would've been a circular import. The other common structs are defined in their respective nut file but since these don't fit in that paradigm I put them in cdk-common. Not sure if it's the right spot.
There was a problem hiding this comment.
Yeah great point. I don't know what the right answer is. I think this is fine, we can get feedback from the cdk community when this makes its way into a PR there. Soon.
|
@vnprc something to consider is explicitly limiting the number of share hashes the client can request at a time to prevent a DoS from someone requesting an unreasonable number of quote IDs. |
|
Good point! Cashu can do blinded auth tokens. I intend to rate limit every DoSable pool resource with an HTTP 402 ecash flow. I believe this is how all paid APIs will work in the future. We could also place a limit on the number of quotes you can request in a single API call. I think we should hold off on building this infrastructure until the need arises. Keep it simple for as long as possible. Make it complex only when you have to. |
Description
This PR adds a new GET endpoint to support fetching quote IDs for a given set of share hashes in HashPool. Currently, the pool, mint, and translator proxies are sharing state via Redis but since miners in general will not have access to Redis directly we need a standard way for them to share the quote UUID <-> share hash mapping.
Notes to the reviewers
The redis client is initialized on each request which is ok for local development and testing but in a production environment we will want to reuse the connection, consider reconnect logic, etc. I wasn't sure the best way to handle that in its current state.
Suggested CHANGELOG Updates
CHANGED
ADDED
Adds a
/v1/mint/quote-ids/shareroute for looking up quote IDs from share hashes.REMOVED
FIXED
Checklist
just final-checkbefore committing