nip55: expose nip55_max_batch_size() so the batch cap has a single source - #974
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe mobile crate now exposes the NIP-55 maximum batch size through a new UniFFI-exported function. The underlying constant is crate-visible and remains set to 20. ChangesNIP-55 batch size exposure
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized change centralizes the batch-size value without any actionable merge-blocking risk remaining; it is merge-ready after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Verified locally: The framing in the description is the part worth agreeing with explicitly. The duplication exists because keep-android deliberately does not call Checked the things that would make this wrong rather than just reading it. No test asserting the exported value equals the enforced one, and I do not think one is warranted: One sequencing note for whoever merges: keep-android #513 needs a No blockers. |
The NIP-55 batch cap (
MAX_BATCH_SIZE = 20) is duplicated in the Rusthandle_batch_requestand the keep-android Kotlin accumulation loop, and must be kept in sync by hand.keep-android does not call the bulk
handle_batch_request— it runs a Kotlin loop so eachsign_eventcan interleave apreApproveNostrEventbefore signing — so the cap lives on both sides of the RMP boundary.This makes Rust the single source of truth for the cap value:
MAX_BATCH_SIZEbecomespub(crate)and is exposed vianip55_max_batch_size(), mirroring the existingbackup_min_passphrase_length(). keep-android reads it instead of hardcoding20(companion keep-android PR).Refs privkeyio/keep-android#327.
Summary by CodeRabbit