diem / diem/move

[Feature Request] Make VM parametric in event format

Open
#29 3 comments 1 reaction 1 assignee Claimed by @vgao1996 View on GitHub
enhancement
Dominant language
Rust
Stars
378
Forks
137
PR merge metrics
No merged PRs in 30d

Description

To support user-defined events emitted during execution, the VM keeps a `Vec` log, where `Event` as defined as

```
pub type Event = (Vec, u64, TypeTag, Vec)
```

[here](https://github.com/diem/move/blob/main/language/move-core/types/src/effects.rs). In this representation, the event's user-defined type is in the `TypeTag` and the event value of this type is in the `Vec`.

However, there's no reason why events must have this structure--conceptually, the VM could just as easily allow the adapter to choose the structure of `Event`. This would be useful for an adapter we are currently working on where events look a bit different, and I expect that future adapters will find other uses of events that might not want to use this structure.

Note: the Move stdlib has an `Event` module and accompanying `emit` native function that *do* rely on the structure the VM assumes. We should think carefully about how we want to handle this. One option is splitting out a part of the Move stdlib that is fully generic and would be used by every conceivable adapter (e.g., `Vector`, `Signer`, `Option`, `BitVector`, `ASCII`, `FixedPoint32`). But that's a topic for another issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.