refactor!: merging event emission functions#16126
Conversation
| } | ||
| } | ||
|
|
||
| // TODO: rename to emit_event_in_public |
There was a problem hiding this comment.
The naming is now inconsistent. Would the reviewer agree with the rename? If yes, will tackle in a followup PR.
There was a problem hiding this comment.
It's just the _log suffix no? Sure, I don't think it's very important. We may want to change these to be methods soon anyway.
There was a problem hiding this comment.
Sure, I don't think it's very important.
I thought you are a "cute code" kind of person 😔
We may want to change these to be methods soon anyway.
WDYM by this? Methods of context?
There was a problem hiding this comment.
Methods of the event type. So you'd do something like event.emit instead of emit_event(event)
33bb6af to
6c58546
Compare
nventuro
left a comment
There was a problem hiding this comment.
Thanks a lot for the responses to the review comments!
| } | ||
| } | ||
|
|
||
| // TODO: rename to emit_event_in_public |
There was a problem hiding this comment.
Methods of the event type. So you'd do something like event.emit instead of emit_event(event)
6c58546 to
66dbaad
Compare
## 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.
66dbaad to
0a136a7
Compare

Summary
This PR consolidates the event emission API by merging
emit_event_in_private_logandemit_event_as_offchain_messageinto a singleemit_event_in_privatefunction with configurable delivery modes.Key Changes
PrivateLogContentConstraintsEnumwithMessageDeliveryEnumthat provides clear delivery mode optionsCONSTRAINED_ONCHAIN: Constrained encryption + tagging + private log stream (for smart contract decisions)UNCONSTRAINED_OFFCHAIN: Unconstrained encryption + offchain delivery (for trusted/incentivized scenarios)UNCONSTRAINED_ONCHAINmode for existing code (marked for future removal)Benefits
Breaking Changes
emit_event_in_private_log→emit_event_in_privateemit_event_as_offchain_message→emit_event_in_privatewithUNCONSTRAINED_OFFCHAINmodePrivateLogContent→MessageDeliveryAll contract examples and tests have been updated to use the new API.