feat(aztec-nr)!: introduce SenderForTags, remove set_sender_for_tags oracle (F-564)#22728
Closed
nchamo wants to merge 1 commit intomerge-train/fairiesfrom
Closed
feat(aztec-nr)!: introduce SenderForTags, remove set_sender_for_tags oracle (F-564)#22728nchamo wants to merge 1 commit intomerge-train/fairiesfrom
nchamo wants to merge 1 commit intomerge-train/fairiesfrom
Conversation
Contributor
Author
|
We are going with #22672 for now, since it's less breaking that this PR |
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.
Problem
Private log discovery relies on a sender-recipient shared secret: the sender tags a log so the recipient can find it by scanning for known tags. The sender identity used for this came from
set_sender_for_tags, TX-wide mutable state that any contract in the call stack could overwrite — silently redirecting all subsequent tag derivation to an arbitrary address.#22672 addressed this by scoping
set_sender_for_tagsoverrides to the calling contract only, so they no longer leak to subcalls. The wallet also gained asendMessagesAsoption to seed the sender before execution begins. This fixed the trust issue, butset_sender_for_tagsremained as ambient global state. The sender used for any given log was determined by a side-effecting call somewhere else in the call stack, rather than at the emission site — making transaction flows hard to reason about.Our fix
This PR takes a different approach: instead of scoping ambient state, we eliminate it.
set_sender_for_tagsis removed entirely. Sender selection moves to the log emission site via a newSenderForTagsstruct passed directly toMessageDelivery:SenderForTags::explicit(address)— for call sites that know their sender (e.g. account contracts tagging their own notes)SenderForTags::tx_default()— for application contracts that delegate sender selection to the wallet; reads from the oracle the wallet seeds viasendMessagesAsMessageDeliveryis refactored from a global constant struct withu8fields to a proper struct type with named constructors (MessageDelivery::offchain(),MessageDelivery::onchain_constrained(), etc.). On-chain variants accept an optionalSenderForTagsoverride via_with_senderconstructors, giving call sites explicit per-log control over which sender is used for tag derivation. This also gives us more flexibility for future features — for example, using a different sender identity per message type, or integrating handshake-based tagging when constrained tagging lands (#14565).The wallet-side
sendMessagesAsoption from #22672 is preserved.DeployAccountMethodinjects the to-be-deployed address assendMessagesAsforNO_FROMself-paid deploys, so fee-payment calls have a sender even without an account entrypoint.Breaking changes
MessageDelivery.OFFCHAIN→MessageDelivery::offchain(), same forONCHAIN_UNCONSTRAINEDandONCHAIN_CONSTRAINEDNoteMessage::deliver(u8)/deliver_to(addr, u8)→ takesMessageDeliveryinstead ofu8EventMessage::deliver_to(addr, u8)→ sameset_sender_for_tagsoracle removed; account contracts useSenderForTags::explicit(self.address)at the emission site insteadThis is not ready to merge as-is — posting for early feedback on the approach before we go further.
Fixes F-564