ref-fvm
ref-fvm copied to clipboard
Feature Request: First-Class Events
An event is effectively the inverse of a method:
- Method: The caller calls a method defined by the callee.
- Event: The sender sends an event defined by the sender.
In the current Filecoin actors, an actor A can register for an event from actor B and ask to be called back on a specific method (usually with some params). However, if not done carefully, this can be used to trick actor B into invoking an arbitrary method on some privileged actor.
With first-class events, there would be no confusion.
There are a couple of possible implementations:
- A new wasm-level function and a new send primitive. This, unfortunately, extends runtime interface.
- A "receive event" endpoint (kind of like "send"). In this case, we'd probably want to reserve a set (1024?) of methods.
- A top-level field in the parameters to specify the type of message.
The event would then need to specify:
- Some event identifier/number (relative to the sender). This is analogous to a method number.
- The event parameters.