diff --git a/Cargo.lock b/Cargo.lock index 7e9e0338b1..6c58807fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10528,7 +10528,6 @@ version = "0.0.0" dependencies = [ "async-trait", "futures", - "serde", "starknet_sequencer_infra", "starknet_state_sync_types", ] diff --git a/crates/blockifier/src/execution/call_info.rs b/crates/blockifier/src/execution/call_info.rs index ee47c07b27..def7dcf476 100644 --- a/crates/blockifier/src/execution/call_info.rs +++ b/crates/blockifier/src/execution/call_info.rs @@ -136,6 +136,16 @@ impl CallInfo { CallInfoIter { call_infos } } + fn specific_event_summary(&self) -> EventSummary { + let mut event_summary = EventSummary::default(); + event_summary.n_events = self.execution.events.len(); + for OrderedEvent { event, .. } in self.execution.events.iter() { + event_summary.total_event_data_size += u64_from_usize(event.data.0.len()); + event_summary.total_event_keys += u64_from_usize(event.keys.len()); + } + event_summary + } + pub fn summarize(&self) -> ExecutionSummary { let mut executed_class_hashes: HashSet = HashSet::new(); let mut visited_storage_entries: HashSet = HashSet::new(); @@ -165,14 +175,7 @@ impl CallInfo { ); // Events. - event_summary.n_events += call_info.execution.events.len(); - for OrderedEvent { event, .. } in call_info.execution.events.iter() { - // TODO(barak: 18/03/2024): Once we start charging per byte - // change to num_bytes_keys - // and num_bytes_data. - event_summary.total_event_data_size += u64_from_usize(event.data.0.len()); - event_summary.total_event_keys += u64_from_usize(event.keys.len()); - } + event_summary += call_info.specific_event_summary(); } ExecutionSummary {