-
Notifications
You must be signed in to change notification settings - Fork 683
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
Event improvment: independent from frame-system, stored in multiples values, ensure not in PoV #309
Comments
from my undestanding of PoV, events are currently not part of PoV as long as nobody read them in on_runtime_ugprade. This should be improved by moving on_runtime_ugprade after the deletion of event probably. For the splitting of events in multiple values, I think we should first look into the limit of the database. Isolating event deposit in its own crate can be done it should be quite easy, I would like to know an example usecase if possible |
Why? |
unfortunately I couldn't solve this before my off days here are the step I will take to resolve this:
|
In Phala's implementation, we have separated our MessageQueue notification events from the system events (to walk-around the event decoding problem). We've made a separate My question is, can we also utilize the PoV erasure feature also for our customized event buffer? |
What PoV erasure feature are you meaning? |
for now we don't plan any specific PoV erasure feature for event. When paritytech/substrate#8931 lands, the event won't be part of PoV if they are not read from the runtime. (I believe runtime can still read event without putting them in the PoV as long as they do so after the first kill in on_initialize put I am not sure). |
Yes that is correct. |
Not sure if this is said elsewhere, but what we need is actually to split the current events into two:
If I understand correctly, Ethereum, Cosmos, and probably many other blockchains do not place the overhead of events into the state. I believe the main reason we events in state is to help support light clients. Specifically, if they are not in state, a light client would not be able to know if an event occured on chain. However, many events are probably just "logs". Things that would be super useful to track in block explorers, or for fully fledged front-ends backed by a full node. But not super relevant for light clients. In fact, I would potentially argue that most events which are relevant to a light client, might actually be replaced with logic around just checking extrinsic and success. |
We already have this, we have the events and then we got logs aka digests. So, it is actually the other way around as you described it. Logs/digests can be found in the header and are easily trackable by light clients as they don't need to look into the state to find out what kind of events have been posted. On the long run we will also move events offchain: #245 |
We already have the real logs (the one we print out things). Logs are not stored anywhere but can be easily reproduced by re-execute the block. Right now they are mostly only used for debugging but there is no reason we can't use them for tracing purpose as well. |
Based on @bkchr's comment, we actually have 3 levels of things:
Digests are information places in the header for light clients. We could have done the same for events as well, by putting a Events as they stand now are not kept in state forever and are useful for light clients to get strong evidence that a certain transition happened. What is being proposed here as Logs is something like Events but without the ability of any proof to be generated based on it. We can simply call them Unprovable Events, as opposed to the runtime events that are prove-able. In the simplest case, it can be implement dead-simple via a new storage item that is deleted at the end of the block, and a new runtime api called In any case, as far as I know this line of work, as described in the issue, will not be continued and we will focus more on #245 |
* Simple sync_block function for mapping_sync * MetaDb operating functions * Implement sync_one_block * Implement sync_blocks * Implement mapping sync worker * Implement mapping sync worker * Remove consensus-layer import code * Fix genesis block syncing logic * Fix importing logic
From last calls here are the point we highlighted for event:
isolate the deposit of event in a new crate: we want it be able to store event more easily without depending on frame-system.
actually I am personally not sure of this one, frame-system seems to be an OK dependency to have everywhere, but I'm not very aware of XCM stuff so maybe it is better to isolate in a new crate: frame-event.
store in multiple values: so that we can store more event without having a too big value.
the cost of having a too big value is only in the client, from the runtime we only add some bytes to a value. I don't have benchmark to know where the size of the value start to be critical for rockdb, paritydb and the client usage of the database.
splitting is easy we store at most N event per value, once it is filled, we use a new value to store them.
the crate would ensure that no read of event is made before it is deleted. This is important for PoV, as we don't want event to be part of PoV.
currently events are removed in system initialize, only on_runtime_upgrade is executed before.
Better to move it before on_runtime_upgrade hook. Also I think we could move system initialize before on_runtime_upgrade.(maybe we can make the storage private, so pallet can't read from it (except in test with some function with explicit name))
The text was updated successfully, but these errors were encountered: