Skip to content

feat(note-transport): add verified note submission - #2648

Merged
kkovaacs merged 11 commits into
krisztian/note-transport-add-cursor-noncefrom
krisztian/note-transport-require-note-inclusion
Sep 22, 2026
Merged

kkovaacs merged 11 commits into
krisztian/note-transport-add-cursor-noncefrom
krisztian/note-transport-require-note-inclusion

Conversation

@kkovaacs

Copy link
Copy Markdown
Collaborator

Summary

  • Add a new SendNoteWithProof endpoint to verify inclusion against a configured trusted node before storing notes. Cache note root commitments fetched from the trusted node with a bounded LRU and retry transient lookups within the request timeout budget.
  • Distinguish unverified after_block_num hints from verified included_in_block values in fetch responses and storage.

Changelog

[[entry]]
scope       = "note-transport"
impact      = "breaking"
description = "Added new `SendNoteWithProof` endpoint requiring inclusion proofs for submitted notes."

@Mirko-von-Leipzig
Mirko-von-Leipzig added this pull request to stack #2661 September 21, 2026 10:26
Comment thread bin/note-transport/src/db/migrations/003_included_in_block.sql Outdated
Comment thread bin/note-transport/src/db/tests.rs Outdated
Comment thread bin/note-transport/src/server/send_note_with_proof.rs
Comment thread bin/note-transport/src/server/send_note.rs Outdated
Comment thread bin/note-transport/src/server/mod.rs Outdated

@igamigo igamigo 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.

LGTM. I didn't look too much into this but the two endpoint variants require note details that quite closely resemble what the variants in NoteFile represent (https://github.com/0xMiden/protocol/blob/next/crates/miden-standards/src/note/file.rs#L75-L95) so I wonder if it's possible to reuse those messages.

Comment on lines +20 to +21
// Unverified lower bound for the inclusion block. An absent value differs from block zero.
optional blockchain.BlockNumber after_block_num = 2;

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.

Should we make this non-optional? I don't believe there is currently any value in it being optional at all, but maybe I'm missing something

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.

We just kept the behavior of the note transport layer, where this has been optional. Are you saying that the client is always sending the after_block_num hint?

Comment thread proto/proto/note_transport.proto Outdated
Comment on lines +42 to +47
// Optional unverified lower bound supplied through SendNote.
// An absent value differs from block zero.
optional blockchain.BlockNumber after_block_num = 3;
// Exact inclusion block verified through SendNoteWithProof.
// This field is absent for notes stored through SendNote.
optional blockchain.BlockNumber included_in_block = 4;

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.

Can this be a oneof? Not sure if the plan is to keep SendNote or not

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.

There are two ways forward:

  1. We remove SendNote and keep only the verified submission path. In that case I wouldn't convert this to a oneof.
  2. @bobbinth suggested that we can also keep SendNote but keep unverified notes only for a short time (a few minutes). If the note is not included on chain within that time we'd just remove them. Personally I think having both paths is a bit overlapping in functionality.

The second route basically wouldn't need changes in the client -- you could still submit notes without a proof and the note transport layer would take care of checking which of those get included on chain (and evict the rest).

However, if we change the client to wait for inclusion before submitting the note there's now point in keeping SendNote IMO.

Comment thread bin/note-transport/src/server/send_note.rs
@kkovaacs
kkovaacs force-pushed the krisztian/note-transport-require-note-inclusion branch 2 times, most recently from 4eed76f to 7733be0 Compare September 21, 2026 20:22
@kkovaacs
kkovaacs force-pushed the krisztian/note-transport-require-note-inclusion branch 2 times, most recently from 31653e0 to a67c3e0 Compare September 22, 2026 08:19
@kkovaacs
kkovaacs force-pushed the krisztian/note-transport-require-note-inclusion branch from a67c3e0 to bf13fe5 Compare September 22, 2026 11:27
@kkovaacs
kkovaacs force-pushed the krisztian/note-transport-require-note-inclusion branch from bf13fe5 to a84c58b Compare September 22, 2026 12:02
@kkovaacs
kkovaacs removed this pull request from stack #2661 September 22, 2026 12:09
@kkovaacs
kkovaacs added this pull request to stack #2673 September 22, 2026 12:09
@kkovaacs
kkovaacs force-pushed the krisztian/note-transport-require-note-inclusion branch from a84c58b to 409961d Compare September 22, 2026 12:39
@kkovaacs
kkovaacs merged commit ff06af4 into next Sep 22, 2026
27 checks passed
@kkovaacs
kkovaacs deleted the krisztian/note-transport-require-note-inclusion branch September 22, 2026 12:45
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.

3 participants