Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

feat(execution): add entry_point_syscall_counter #1407

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub struct DeprecatedSyscallHintProcessor<'a> {
pub inner_calls: Vec<CallInfo>,
pub events: Vec<OrderedEvent>,
pub l2_to_l1_messages: Vec<OrderedL2ToL1Message>,
pub syscall_counter: SyscallCounter,

// Fields needed for execution and validation.
pub read_only_segments: ReadOnlySegments,
Expand Down Expand Up @@ -133,6 +134,7 @@ impl<'a> DeprecatedSyscallHintProcessor<'a> {
inner_calls: vec![],
events: vec![],
l2_to_l1_messages: vec![],
syscall_counter: SyscallCounter::default(),
read_only_segments: ReadOnlySegments::default(),
syscall_ptr: initial_syscall_ptr,
read_values: vec![],
Expand Down Expand Up @@ -289,6 +291,8 @@ impl<'a> DeprecatedSyscallHintProcessor<'a> {
fn increment_syscall_count(&mut self, selector: &DeprecatedSyscallSelector) {
let syscall_count = self.resources.syscall_counter.entry(*selector).or_default();
*syscall_count += 1;
let entry_point_syscall_count = self.syscall_counter.entry(*selector).or_default();
*entry_point_syscall_count += 1;
}

fn allocate_tx_signature_segment(
Expand Down
4 changes: 4 additions & 0 deletions crates/blockifier/src/execution/syscalls/hint_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub struct SyscallHintProcessor<'a> {
pub inner_calls: Vec<CallInfo>,
pub events: Vec<OrderedEvent>,
pub l2_to_l1_messages: Vec<OrderedL2ToL1Message>,
pub syscall_counter: SyscallCounter,

// Fields needed for execution and validation.
pub read_only_segments: ReadOnlySegments,
Expand Down Expand Up @@ -164,6 +165,7 @@ impl<'a> SyscallHintProcessor<'a> {
inner_calls: vec![],
events: vec![],
l2_to_l1_messages: vec![],
syscall_counter: SyscallCounter::default(),
read_only_segments,
syscall_ptr: initial_syscall_ptr,
read_values: vec![],
Expand Down Expand Up @@ -404,6 +406,8 @@ impl<'a> SyscallHintProcessor<'a> {
pub fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, n: usize) {
let syscall_count = self.resources.syscall_counter.entry(*selector).or_default();
*syscall_count += n;
let entry_point_syscall_count = self.syscall_counter.entry(*selector).or_default();
*entry_point_syscall_count += n;
}

fn increment_syscall_count(&mut self, selector: &SyscallSelector) {
Expand Down
Loading