aztec-packages icon indicating copy to clipboard operation
aztec-packages copied to clipboard

feat!: return metadata associated to private events

Open mverzilli opened this issue 2 months ago • 0 comments

Related to https://github.com/AztecProtocol/aztec-packages/issues/16245 Part of F-96

Note this changeset as is right now doesn't even compile, and many details (such as stale comments) are not there yet. Sharing early to discuss broad strokes API.

Dependencies

  • Built on top of https://github.com/AztecProtocol/aztec-packages/pull/18190.
  • It might be advisable to tackle a small refactor of InBlock before actually moving forward with this.

New types

  • PrivateEvent<T>: packs together an ABI decoded event and contextual metadata.
  • PrivateEventMetadata: initially includes block info (InBlock), tx info (InTx), and even recipient.
  • PrivateEventFilter: weaker version of PrivateEvent to represent filters. Takes some hints from Aztec Node's LogFilter.

Quirks

Aztec Node's LogFilter establishes fromBlock to be inclusive, and toBlock exclusive, so I'm leaning towards respecting that convention here. It results in some idiosyncratic choices when defining defaults. At a first approximation, I think defaulting to "returns events emitted in the latest known block" is reasonable, but open to other ideas.

I opted to leave EventSelector and/or EventMetadataDefinition out of the filter type, to avoid having to define one filter type per layer (one with EventMetadataDefinition for the Wallet API, one with EventSelector for the PXE). It's also a debatable design choice.

mverzilli avatar Nov 06 '25 12:11 mverzilli