0xMiden / 0xMiden/note-transport-service

Legacy-cursor reset never converges (rcursor computed from original cursor)

Aperta
#130 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug production-readiness
Lingua principale
Rust
Stelle
3
Fork
10
Merge medio
2h 23m
PR unite (30g)
4

Descrizione

Severity: high (correctness bug).

### Summary

The DB layer treats a cursor > 10^12 (pre-`seq` microsecond timestamps) as 0 (`crates/node/src/database/sqlite/mod.rs:160-166`), but the gRPC handler computes the response cursor from the **original** request cursor: `let mut rcursor = cursor;` then `max` with the returned seqs (`crates/node/src/node/grpc/mod.rs:261`).

### Impact

A client sending a legacy cursor (~1.7e15) gets the oldest 500 notes plus `rcursor ≈ 1.7e15`; its next fetch sends the same cursor, gets the same 500 notes again — forever. It never advances past the first batch and permanently re-downloads duplicates.

### Recommendation

Perform the legacy reset in the handler (or return the effective cursor from the DB layer) so `rcursor = max(effective_cursor, max_seq)`.

Related: #101.

---
Part of #114.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.