0xMiden / 0xMiden/rust-sdk

Support optional limit parameter in NTL fetch_notes

Đang mở
#2,107 2 bình luận 0 reaction 1 người được giao Được @JereSalo nhận Xem trên GitHub
blocked
Ngôn ngữ chính
Rust
Star
78
Fork
129
Merge trung bình
4 ngày 14 giờ
Pull request đã merge (30 ngày)
52

Mô tả

## Context

The Note Transport Layer (NTL) now supports an optional `limit` field on `FetchNotesRequest` ([0xMiden/note-transport-service#84](https://github.com/0xMiden/note-transport-service/pull/84)). This lets clients request smaller pages instead of always receiving up to 500 notes per call.

```protobuf
message FetchNotesRequest {
repeated fixed32 tags = 1;
fixed64 cursor = 2;
// Maximum number of notes to return. When unset the server applies its
// own batch cap (currently 500). Values above the server cap are clamped.
optional uint32 limit = 3;
}
```

## Proposed client changes

The `miden-client` calls `fetch_transport_notes` during sync. Currently it sends `FetchNotesRequest` without a `limit`, receiving up to 500 notes per call. The client should:

1. **Pass through the limit field** in the NTL gRPC client code. No behavioral change needed if `limit` is left unset - the server default (500) applies.

2. **Consider setting a limit for constrained environments.** Browser extensions (service workers) and mobile wallets that sync every few seconds may benefit from requesting smaller batches (e.g. 10-50 notes) to keep each response lightweight. This could be a configuration option on the client.

3. **Proto update.** Regenerate the NTL proto bindings in the client to pick up the new `limit` field. The field is `optional`, so the client compiles without changes - but it can't use the feature until the bindings are regenerated.

## Priority

Low. The existing behavior (no limit, server caps at 500) works fine for most clients. This is primarily useful for constrained environments that poll frequently.

Relates to [0xMiden/note-transport-service#46](https://github.com/0xMiden/note-transport-service/issues/46) and [0xMiden/note-transport-service#4](https://github.com/0xMiden/note-transport-service/issues/4).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.