Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,13 @@ impl<T: Trait> Module<T> {
pub fn deposit_event_indexed(topics: &[T::Hash], event: T::Event) {
let block_number = Self::block_number();
// Don't populate events on genesis.
if block_number.is_zero() { return }
if block_number.is_zero() {
// Print a message only in tests warning users about this behavior.
#[cfg(test)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not changes anything outside the crate. The test feature is only enabled for a crate when the crate itself is build for testing. This means, any other crate using frame_system will not print anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, is there some attribute that does what I intend?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope^^

println!("The block number is zero, so events are not being deposited.");

return
}

let phase = ExecutionPhase::get().unwrap_or_default();
let event = EventRecord {
Expand Down