-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIP-44][Discussion] Module Events #200
Comments
Will these be treated as part of the authenticated data structure, e.g. can these be queried during runtime as if they were typical data? Will this change be backwards compatible with the existing framework, e.g. will this be a breaking change for legacy projects that use the current event handle schema? |
Events are always part of the authenticated data structure as they contribute to the final ledger hash; however, they cannot be queried by move code during runtime as they are not data in state tree. They are actually stored in another tree. Similarly, Ethereum stores its events in receipt Trie iirc. Unfortunately, it is not backwards compatible with the existing events (v1) since it is totally redesigned. It is not a breaking change as it's not going to replace v1 but just another(preferred) option for emitting events. The projects using existing event scheme will be supported but we believe devs will mostly prefer module events (v2) for all new projects as it is superior in all aspects. |
There may be utility in having a switch in the struct definition that would persist the storage of the event to the state tree to facilitate querying during runtime. Of course - this would have to come with necessary increases in gas fees if that switch was used. |
@magnum6actual we may adds utility functions to for test only purpose. Module events is a normal struct so if you wanna store event data somewhere as state as your wish, it is totally legit. But the purpose of event stream framework is to deliver notifications with metadata to for offchain systems. Another caveat to mention is differing from latest state, events are not guaranteed to be available forever as they're subject to pruning. |
@lightmark is the idea here to maximize pruning with the new event framework to consolidate event storage to gRPC streamers? |
@alnoki It has nothing to do with that. For pruning it will be the same with the old event stream. |
I suggest introducing the |
I think for this solution, |
If the developer carelessly provides a published new function for an event, anyone can trigger a fake event. |
Hi! So, as for me, I think the compatibility with previous version is also very useful and important. Especially, for first, initial period of adoption new one. |
you mean provide a public function emitting module events? In programming, public function just means anyone can trigger the logic inside this function. I failed to see any loophole here. |
Could you elaborate the compatibility you want? We keep both events coexisting and respect their emitting order. |
A public construct function, like |
Hi! It would be nit so bad. |
Even if you do that by mistake, |
AIP Discussion
This AIP defines module-level event framework targeting to replace the current instance event framework.
The new event framework associates every event stream with a static struct type instead of an
EventHandle
instance.In short, an event will be defined like this:
where emit event will be as simple as:
Read more about it here: Link to AIP
The text was updated successfully, but these errors were encountered: