ref-fvm icon indicating copy to clipboard operation
ref-fvm copied to clipboard

Feature Request: First-Class Events

Open Stebalien opened this issue 4 years ago • 0 comments

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:

  1. A new wasm-level function and a new send primitive. This, unfortunately, extends runtime interface.
  2. A "receive event" endpoint (kind of like "send"). In this case, we'd probably want to reserve a set (1024?) of methods.
  3. A top-level field in the parameters to specify the type of message.

The event would then need to specify:

  1. Some event identifier/number (relative to the sender). This is analogous to a method number.
  2. The event parameters.

Stebalien avatar Oct 21 '21 15:10 Stebalien