0xMiden / 0xMiden/note-transport-service
SendNote is not idempotent — duplicate send returns INTERNAL
- Linguagem predominante
- Rust
- Estrelas
- 3
- Forks
- 10
- Merge médio
- 2h 23min
- PRs com merge (30d)
- 4
Descrição
Severity: high (correctness / retry safety).
### Summary
The schema has `id BLOB NOT NULL UNIQUE`, so re-sending the same note hits a UNIQUE constraint. `store_note` maps every error to `Status::internal(format!("Failed to store note: {e:?}"))` (`crates/node/src/node/grpc/mod.rs:197-199`), so a duplicate comes back as `INTERNAL: Failed to store note: ConstraintViolation(...)`.
### Impact
The standard retry-after-timeout pattern (first attempt committed, ack lost) makes the retry fail with a scary internal error. Wallets cannot distinguish "already delivered" from "server broken", which pushes clients toward *not* retrying — bad when this service is the sole holder of the payload. (`note_exists` exists in the DB API but no handler calls it.)
### Recommendation
Catch the `ConstraintViolation` in `send_note` and return `Ok(SendNoteResponse{})` (idempotent success) or `ALREADY_EXISTS`. Document `SendNote` as idempotent on `NoteId`.
---
Part of #114.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.