0

On one hand, if we emit extrinsic event with no data and other hand we emit the extrinsic event with data. Will the second option will increase the block size or on both cases the block-size will be same?

1 Answer 1

2

The actual events are not stored in the block, rather they are part of your blockchain's state and are stored in your blockchain's storage.

The state root is the only thing related to your events that is stored in the block and that will change accordingly.

/// Events deposited for the current block.
///
/// NOTE: The item is unbound and should therefore never be read on chain.
/// It could otherwise inflate the PoV size of a block.
///
/// Events have a large in-memory size. Box the events to not go out-of-memory
/// just in case someone still reads them from within the runtime.
#[pallet::storage]
#[pallet::whitelist_storage]
#[pallet::unbounded]
pub(super) type Events<T: Config> =
    StorageValue<_, Vec<Box<EventRecord<T::RuntimeEvent, T::Hash>>>, ValueQuery>;

Events are stored in an unbounded vector in storage therefore you should never have logic in your runtime that interacts with events.

So my advice is to analyze events from a blockchain storage perspective and not from a block perspective.

For example, if you have lots of "heavy" events accumulating in your storage, it would require more of an archive node to sync with your chain.

Related questions:

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.