Skip to content

Commit

Permalink
Fix memory_holes showing up on trace API even tho it is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Nov 30, 2023
1 parent b2480b3 commit fa568c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vm/rust/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ impl From<BlockifierOrderedEvent> for OrderedEvent {
#[derive(Serialize)]
pub struct ExecutionResources {
pub steps: usize,
pub memory_holes: usize,
#[serde(skip_serializing_if = "Option::is_none")]
pub memory_holes: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")]
pub range_check_builtin_applications: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -219,7 +220,11 @@ impl From<VmExecutionResources> for ExecutionResources {
fn from(val: VmExecutionResources) -> Self {
ExecutionResources {
steps: val.n_steps,
memory_holes: val.n_memory_holes,
memory_holes: if val.n_memory_holes > 0 {
Some(val.n_memory_holes)
} else {
None
},
range_check_builtin_applications: val.builtin_instance_counter.get(RANGE_CHECK_BUILTIN_NAME).cloned(),
pedersen_builtin_applications: val.builtin_instance_counter.get(HASH_BUILTIN_NAME).cloned(),
poseidon_builtin_applications: val.builtin_instance_counter.get(POSEIDON_BUILTIN_NAME).cloned(),
Expand Down

0 comments on commit fa568c4

Please sign in to comment.