From 6a9b96ce40367f393f9caa3dada7888394aa7144 Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Sun, 17 Nov 2024 19:03:59 +0200 Subject: [PATCH] feat(blockifier): charge for inner events by VC check --- .../resources/versioned_constants_0_13_0.json | 1 + .../resources/versioned_constants_0_13_1.json | 1 + .../resources/versioned_constants_0_13_1_1.json | 1 + .../resources/versioned_constants_0_13_2.json | 1 + .../resources/versioned_constants_0_13_2_1.json | 1 + .../resources/versioned_constants_0_13_3.json | 1 + .../resources/versioned_constants_0_13_4.json | 1 + crates/blockifier/src/execution/call_info.rs | 10 ++++++++-- crates/blockifier/src/versioned_constants.rs | 1 + 9 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/blockifier/resources/versioned_constants_0_13_0.json b/crates/blockifier/resources/versioned_constants_0_13_0.json index 3e1b7703e0..db601b2552 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_0.json +++ b/crates/blockifier/resources/versioned_constants_0_13_0.json @@ -8,6 +8,7 @@ "segment_arena_cells": true, "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, + "charge_for_inner_events": true, "enable_reverts": false, "tx_event_limits": { "max_data_length": 1000000000, diff --git a/crates/blockifier/resources/versioned_constants_0_13_1.json b/crates/blockifier/resources/versioned_constants_0_13_1.json index 3a12982a71..6599bee603 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1.json @@ -41,6 +41,7 @@ "segment_arena_cells": true, "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, + "charge_for_inner_events": false, "enable_reverts": false, "os_constants": { "nop_entry_point_offset": -1, diff --git a/crates/blockifier/resources/versioned_constants_0_13_1_1.json b/crates/blockifier/resources/versioned_constants_0_13_1_1.json index 533d2c5cb8..99b1eb8383 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_1_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_1_1.json @@ -41,6 +41,7 @@ "segment_arena_cells": true, "disable_cairo0_redeclaration": false, "enable_stateful_compression": false, + "charge_for_inner_events": true, "enable_reverts": false, "os_constants": { "nop_entry_point_offset": -1, diff --git a/crates/blockifier/resources/versioned_constants_0_13_2.json b/crates/blockifier/resources/versioned_constants_0_13_2.json index cb35171d91..24d8c6e38e 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2.json @@ -39,6 +39,7 @@ }, "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, + "charge_for_inner_events": true, "enable_reverts": false, "max_recursion_depth": 50, "segment_arena_cells": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_2_1.json b/crates/blockifier/resources/versioned_constants_0_13_2_1.json index fdda72b43b..b0a7dd8dbc 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_2_1.json +++ b/crates/blockifier/resources/versioned_constants_0_13_2_1.json @@ -39,6 +39,7 @@ }, "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, + "charge_for_inner_events": true, "max_recursion_depth": 50, "enable_reverts": false, "segment_arena_cells": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_3.json b/crates/blockifier/resources/versioned_constants_0_13_3.json index fdda72b43b..b0a7dd8dbc 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_3.json +++ b/crates/blockifier/resources/versioned_constants_0_13_3.json @@ -39,6 +39,7 @@ }, "disable_cairo0_redeclaration": true, "enable_stateful_compression": false, + "charge_for_inner_events": true, "max_recursion_depth": 50, "enable_reverts": false, "segment_arena_cells": false, diff --git a/crates/blockifier/resources/versioned_constants_0_13_4.json b/crates/blockifier/resources/versioned_constants_0_13_4.json index eac76d6a7a..083bc145ef 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_4.json +++ b/crates/blockifier/resources/versioned_constants_0_13_4.json @@ -39,6 +39,7 @@ }, "disable_cairo0_redeclaration": true, "enable_stateful_compression": true, + "charge_for_inner_events": true, "enable_reverts": true, "max_recursion_depth": 50, "segment_arena_cells": false, diff --git a/crates/blockifier/src/execution/call_info.rs b/crates/blockifier/src/execution/call_info.rs index e696c6c54b..57ccbf02cd 100644 --- a/crates/blockifier/src/execution/call_info.rs +++ b/crates/blockifier/src/execution/call_info.rs @@ -147,7 +147,7 @@ impl CallInfo { event_summary } - pub fn summarize(&self, _versioned_constants: &VersionedConstants) -> ExecutionSummary { + pub fn summarize(&self, versioned_constants: &VersionedConstants) -> ExecutionSummary { let mut executed_class_hashes: HashSet = HashSet::new(); let mut visited_storage_entries: HashSet = HashSet::new(); let mut event_summary = EventSummary::default(); @@ -176,7 +176,13 @@ impl CallInfo { ); // Events. - event_summary += call_info.specific_event_summary(); + if versioned_constants.charge_for_inner_events { + event_summary += call_info.specific_event_summary(); + } + } + + if !versioned_constants.charge_for_inner_events { + event_summary = self.specific_event_summary(); } ExecutionSummary { diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index d2d6eb7237..8dd85af24e 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -173,6 +173,7 @@ pub struct VersionedConstants { // Transactions settings. pub disable_cairo0_redeclaration: bool, pub enable_stateful_compression: bool, + pub charge_for_inner_events: bool, // Compiler settings. pub enable_reverts: bool,