Add block context fields to TransportNote#81
Open
Dominik1999 wants to merge 3 commits intonextfrom
Open
Conversation
- Add optional commitment_block_num and note_metadata to TransportNote proto - New DB migration adds nullable columns for block context - Update models, types, and gRPC handlers to pass through block context - Backward-compatible: old clients unaffected (fields are proto3 optional) Enables clients to resolve on-chain note commitments deterministically, eliminating the race condition where fast-syncing clients could permanently miss a note's commitment block. Closes #68 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Use i64/BigInt for commitment_block_num DB column to support full u32 range - Return DatabaseError instead of panicking on invalid block number reads - Include note_metadata in payload size validation check - Fix clippy lints (doc backticks, redundant closure) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Expand proto doc comments for commitment_block_num and note_metadata with detailed sender-policy documentation (exact, lower bound, unset) - Regenerate proto bindings with updated docstrings - Add round-trip test: store with block context, fetch, verify through proto conversion, including u32::MAX boundary - Add conversion guard test in models.rs: verify out-of-range i64 values return DatabaseError instead of panicking Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
commitment_block_numandnote_metadatafields toTransportNoteprotoi64/BigIntfor DB storage to support fullu32block number rangenote_metadatain payload size validationThis PR ships the proto + storage primitive only. The NTL is intentionally lean: it stores whatever the sender provides verbatim, with no validation, backfill, or chain awareness. The policy of when and how to populate the new fields lives entirely on the sender (see proto doc comments for strategies).
Client-side follow-up: 0xMiden/miden-client#2108 - consume the new fields to eliminate the note sync race condition. The current client-side workaround is a 20-block lookback window.
Test plan
make testpasses (15/15, including 2 new tests)make lintpassesu32::MAXsurvives theu32->i64->u32round-tripi64returnsDatabaseError, not panicSendNoteaccepts optional block contextFetchNotes/StreamNotesreturn block context when present🤖 Generated with Claude Code
Closes #68