Skip to content

refactor: index NoteUpdateTracker by details commitment#2267

Open
juan518munoz wants to merge 2 commits into
nextfrom
jmunoz-fix-note-record-id
Open

refactor: index NoteUpdateTracker by details commitment#2267
juan518munoz wants to merge 2 commits into
nextfrom
jmunoz-fix-note-record-id

Conversation

@juan518munoz

Copy link
Copy Markdown
Collaborator

Partly tackles #2227

Specifically, it resolves the NoteUpdateTracker followup flagged directly in code:
https://github.com/0xMiden/miden-client/blob/31b387d5ff006b442640275fdd8745062668df6c/crates/rust-client/src/note/note_update_tracker.rs#L226-L229

NoteUpdateTracker now keys all input notes by NoteDetailsCommitment (always available) instead of the NoteId/commitment split, which removes the expected_input_notes map and the InsertCommitted re-keying.

@juan518munoz juan518munoz added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jun 19, 2026

@JereSalo JereSalo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great and I like the simplification. However, there seems to be a roundtrip problem on notes that have lost their note_id information but we still keep that info in the input_notes_by_id index.
This can happen when a note originally had metadata but after being externally consumed we can no longer compute its id, so it's lost and input_notes_by_id gets rebuilt with less information than what it originally had. It's not critical though, I proposed a fix and added a test here if you want to check it out, there's no need to merge it, I just did it in order to effectively check if it was an actual bug or not.

Comment on lines +321 to +324
(matches!(
update.update_type,
NoteUpdateType::Insert | NoteUpdateType::Update | NoteUpdateType::InsertCommitted
) && update.inner().is_consumed())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(matches!(
update.update_type,
NoteUpdateType::Insert | NoteUpdateType::Update | NoteUpdateType::InsertCommitted
) && update.inner().is_consumed())
(update.update_type != NoteUpdateType::None && update.inner().is_consumed())

If you like we could simplify it to this. Though it's completely valid if you prefer to keep it explicit just in case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed this and comment above in fae267c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants