You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
This PR consolidates the event emission API by merging
`emit_event_in_private_log` and `emit_event_as_offchain_message` into a
single `emit_event_in_private` function with configurable delivery
modes.
## Key Changes
- **Unified API**: Replaced `PrivateLogContentConstraintsEnum` with
`MessageDeliveryEnum` that provides clear delivery mode options
- **Two Primary Modes**:
- `CONSTRAINED_ONCHAIN`: Constrained encryption + tagging + private log
stream (for smart contract decisions)
- `UNCONSTRAINED_OFFCHAIN`: Unconstrained encryption + offchain delivery
(for trusted/incentivized scenarios)
- **Enhanced Documentation**: Comprehensive documentation explaining the
three dimensions of message delivery (encryption constraints, delivery
mechanism, tagging constraints) and their use cases
- **Backward Compatibility**: Maintained `UNCONSTRAINED_ONCHAIN` mode
for existing code (marked for future removal)
## Benefits
- **Clearer Intent**: Developers can now choose delivery modes based on
their specific security and trust requirements
- **Simplified API**: Single function handles all private event emission
scenarios
- **Improved Security Model**: Explicit guidance on when to use each
delivery mode
## Breaking Changes
- `emit_event_in_private_log` → `emit_event_in_private`
- `emit_event_as_offchain_message` → `emit_event_in_private` with
`UNCONSTRAINED_OFFCHAIN` mode
- `PrivateLogContent` → `MessageDelivery`
All contract examples and tests have been updated to use the new API.
Copy file name to clipboardExpand all lines: docs/docs/migration_notes.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,17 @@ As we prepare for a bigger `Wallet` interface refactor and the upcoming `WalletS
44
44
45
45
## [Aztec.nr]
46
46
47
+
### Private event emission API changes
48
+
49
+
The private event emission API has been significantly reworked to provide clearer semantics around message delivery guarantees. The key changes are:
50
+
51
+
1.`emit_event_in_private_log` has been renamed to `emit_event_in_private` and now takes a `delivery_mode` parameter instead of `constraints`
52
+
2.`emit_event_as_offchain_message` has been removed in favor of using `emit_event_in_private` with `MessageDelivery.UNCONSTRAINED_OFFCHAIN`
53
+
3.`PrivateLogContent` enum has been replaced with `MessageDelivery` enum with the following values:
54
+
-`CONSTRAINED_ONCHAIN`: For on-chain delivery with cryptographic guarantees (replaces `CONSTRAINED_ENCRYPTION`)
55
+
-`UNCONSTRAINED_OFFCHAIN`: For off-chain delivery without constraints
56
+
-`UNCONSTRAINED_ONCHAIN`: For on-chain delivery without constraints (replaces `NO_CONSTRAINTS`)
57
+
47
58
### Contract functions can no longer be `pub` or `pub(crate)`
48
59
49
60
With the latest changes to `TestEnvironment`, making contract functions have public visibility is no longer required given the new `call_public` and `simulate_utility` functions. To avoid accidental direct invocation, and to reduce confusion with the autogenerated interfaces, we're forbidding them being public.
0 commit comments