0xMiden / 0xMiden/note-transport-service

SendNote is not idempotent — duplicate send returns INTERNAL

Aberta
#129 1 comentário 0 reações 0 responsáveis Ver no GitHub
bug production-readiness
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

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.