Skip to content

feat(aztec-nr): Add a delivery mode to handshake notes#23783

Merged
vezenovm merged 7 commits into
merge-train/fairiesfrom
mv/f-694-handshake-registry-store-a-delivery-mode-on-handshakenote
Jun 2, 2026
Merged

feat(aztec-nr): Add a delivery mode to handshake notes#23783
vezenovm merged 7 commits into
merge-train/fairiesfrom
mv/f-694-handshake-registry-store-a-delivery-mode-on-handshakenote

Conversation

@vezenovm

@vezenovm vezenovm commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Fixes F-694

  • New mode: u8 field on HandshakeNote
  • For the mode I went with a simple u8 and constant identifiers to represent the valid modes. We could switch to a new type, this just will require some extra serialization and type scaffolding. Happy to do that in this PR or file a follow-up. Made F-706 for now as a follow-up.

@vezenovm vezenovm requested a review from nchamo June 1, 2026 20:59

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some question, maybe we need to re-think how we store the mode. Let me know if I missed something though

handshake_type: u8,
/// The delivery mode of messages tagged with this handshake.
/// This is used by the recipient to know how to scan for tags for a given onchain handshake.
mode: u8,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Look at my other comments below. Maybe, instead of storing this here, we should add a new Map to storage:
Map<AztecAddress, Map<Mode, Owned<PrivateMutable<HandshakeNote, Context>, Context>, Context>, Context>,

That way, we can have both handshakes per (sender, recipient) pair

@vezenovm vezenovm Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switching from one handshake per (sender, recipient) to one handshake per (sender, recipient, mode) pair feels like a bigger change in the semantics of the contract and general delivery flow. I prefer keeping the invariant that if a (sender, recipient) pair wants to switch modes, they can just re-handshake. Maintaining handshakes per mode feels like it would add unnecessary complexity at this stage when I am not sure of a concrete use case why an app would want two handshake modes simultaneously. I expect apps to either control delivery/discovery fully e2e, where unconstrained is fine, or need the additional guarantees from constrained delivery.

@nchamo nchamo Jun 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But remember that handshakes are not per app, they are per (sender, recipient). So an app could want to use unconstrained handshakes, while another might need constrained handshakes. Forcing users to perform new handshakes each time they switch apps sounds too expensive when they can simply co-exist.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, good point. Given that, keying by mode is reasonable. I will switch over.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. With this we also were able to simplify HandshakeNote and remove the AppSiloedSecret return type as it is unnecessary to return the mode as well.

@vezenovm vezenovm requested a review from nchamo June 2, 2026 15:26

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!

Really liked the tests 🚀

vezenovm and others added 2 commits June 2, 2026 13:26
…hake_registry_contract/src/main.nr

Co-authored-by: Nicolas Chamo <nicolas@chamo.com.ar>
@vezenovm vezenovm requested a review from nventuro as a code owner June 2, 2026 17:34
@vezenovm vezenovm enabled auto-merge (squash) June 2, 2026 17:35
@vezenovm vezenovm merged commit b00eb8f into merge-train/fairies Jun 2, 2026
12 checks passed
@vezenovm vezenovm deleted the mv/f-694-handshake-registry-store-a-delivery-mode-on-handshakenote branch June 2, 2026 18:05
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jun 4, 2026
BEGIN_COMMIT_OVERRIDE
feat(aztec-nr): Add a delivery mode to handshake notes (AztecProtocol#23783)
fix(pxe): enforce full field consumption at oracle boundaries (AztecProtocol#23802)
chore(ci): Static oracle version check (AztecProtocol#23805)
END_COMMIT_OVERRIDE
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.

2 participants