1

In the Substrate documentation, I came across a statement stating that at the beginning of a new block, the System pallet automatically removes all events that were stored from the previous block. However, I have observed that I can still fetch historical block events despite this automatic removal. I am seeking clarification on this concept.

Here is the screenshot of the relevant section from the documentation: enter image description here I would like to understand how it is possible to retrieve historical block events even after the System pallet has supposedly cleared them. Is there something I am missing or misunderstanding?

Can anyone provide an explanation of the mechanism behind this behavior? Are there any factors that affect the persistence of historical block events despite the automatic removal by the System pallet?

I would greatly appreciate any insights, explanations, or examples that can help clarify this concept.

Thank you for your assistance!

1 Answer 1

1

Yes, you can still fetch and access the events emitted in previous blocks, even though they are automatically removed from the storage of the System pallet at the beginning of a new block.

In Substrate blockchains, events are typically stored in the transaction receipts of each block. Transaction receipts contain information about the execution of transactions, including any events emitted during the transaction's execution.

The behaviour of automatically removing events from the storage of the System pallet at the beginning of a new block is designed to ensure efficiency, reduce storage bloat, and maintain a clear separation between different blocks' state data.

While events are removed from the System pallet's storage, it's important to remember that they are still recorded in the blockchain's transaction receipts for each block. This means that even though they are not directly accessible through the System pallet's storage, they are still available in the blockchain's history and can be retrieved through other means.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.