Skip to content

fix(note): check spent nullifiers during transport import - #2434

Closed
wodesiku wants to merge 2 commits into
0xMiden:nextfrom
wodesiku:fix/transport-nullifier-spent-check
Closed

fix(note): check spent nullifiers during transport import#2434
wodesiku wants to merge 2 commits into
0xMiden:nextfrom
wodesiku:fix/transport-nullifier-spent-check

Conversation

@wodesiku

Copy link
Copy Markdown

What does this PR do?

Marks note-transport imports as ConsumedExternal when their nullifiers were already committed on-chain before the client imported them.

Related Issue

Fixes #2422

Root Cause

Notes delivered through the note transport enter import_note_records_by_details via NoteFile::ExpectedNote. That path discovers and authenticates the note commitment, but it did not query historical nullifier state. The existing get_nullifier_commit_heights check was only used by the inclusion-proof import path.

When a restored client has already synced past a note's spend block, forward nullifier sync starts after the checkpoint and can never observe that historical spend. The transport-imported record therefore remained Committed and was returned as consumable even though the node would reject it as already spent.

Changes Made

  • Batch nullifier lookups for notes found committed during details import.
  • Start the lookup at the earliest imported note inclusion block so historical spends are included.
  • Reuse the existing InputNoteRecord::consumed_externally state transition.
  • Add a transport regression test covering a private note consumed on-chain before its first NTL delivery.
  • Leave notes that are still only Expected unchanged and avoid an RPC call when no committed details are found.

How to Test

Command attempted:

cargo test --locked -p miden-client-unit-tests fetch_private_notes_marks_historically_consumed_note -- --nocapture

The test was blocked before compilation by the Windows environment while building the existing miden-node-proto-build v0.16.0-rc.1 dependency:

file '...miden-node-proto-build-0.16.0-rc.1\proto
emote_prover.proto' is not in any include path

cargo check --locked -p miden-client --features testing hit the same pre-test build-script failure. WSL Ubuntu-22.04 is installed but has no Cargo toolchain. No test assertion failure was observed.

Scope

  • No new dependencies.
  • Cargo.lock unchanged.
  • Focused to note import behavior and its transport integration test.

@igamigo

igamigo commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks! This is already covered by #2438 (which will do a bit more than this), so closing this PR for now.

@igamigo igamigo closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Note-transport imports skip the nullifier spent-check — notes spent below the sync checkpoint stay Committed/consumable forever

2 participants