Skip to content

Commit 8b662b3

Browse files
refactor(blockifier): default increment syscall_count in trait (#6143)
1 parent 1777f1e commit 8b662b3

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

crates/blockifier/src/execution/syscalls/hint_processor.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ impl<'a> SyscallHintProcessor<'a> {
351351
self.allocate_data_segment(vm, &flat_resource_bounds)
352352
}
353353

354-
pub fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, n: usize) {
355-
let syscall_usage = self.syscalls_usage.entry(*selector).or_default();
356-
syscall_usage.call_count += n;
357-
}
358-
359354
pub fn increment_linear_factor_by(&mut self, selector: &SyscallSelector, n: usize) {
360355
let syscall_usage = self
361356
.syscalls_usage
@@ -486,8 +481,9 @@ impl<'a> SyscallHintProcessor<'a> {
486481
}
487482

488483
impl SyscallExecutor for SyscallHintProcessor<'_> {
489-
fn increment_syscall_count(&mut self, selector: &SyscallSelector) {
490-
self.increment_syscall_count_by(selector, 1);
484+
fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, n: usize) {
485+
let syscall_usage = self.syscalls_usage.entry(*selector).or_default();
486+
syscall_usage.call_count += n;
491487
}
492488

493489
fn get_gas_cost_from_selector(

crates/blockifier/src/execution/syscalls/syscall_executor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ pub trait SyscallExecutor {
6565
Ok(felt_from_ptr(vm, self.get_mut_syscall_ptr())?)
6666
}
6767

68-
fn increment_syscall_count(&mut self, selector: &SyscallSelector);
68+
fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, count: usize);
69+
70+
fn increment_syscall_count(&mut self, selector: &SyscallSelector) {
71+
self.increment_syscall_count_by(selector, 1);
72+
}
6973

7074
fn get_gas_cost_from_selector(
7175
&self,

crates/starknet_os/src/hint_processor/snos_syscall_executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::hint_processor::snos_hint_processor::SnosHintProcessor;
5353

5454
#[allow(unused_variables)]
5555
impl<S: StateReader> SyscallExecutor for SnosHintProcessor<'_, S> {
56-
fn increment_syscall_count(&mut self, selector: &SyscallSelector) {
56+
fn increment_syscall_count_by(&mut self, selector: &SyscallSelector, count: usize) {
5757
todo!()
5858
}
5959

0 commit comments

Comments
 (0)