Skip to content

Commit

Permalink
fix trace
Browse files Browse the repository at this point in the history
  • Loading branch information
joshklop committed Nov 23, 2023
1 parent dbf939f commit 5db77ad
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions vm/rust/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ pub struct TransactionTrace {
state_diff: Option<StateDiff>,
}


impl TransactionTrace {
pub fn make_legacy(&mut self) {
self.state_diff = None;
self.r#type = None;
if let Some(invocation) = &mut self.validate_invocation {
invocation.make_legacy()
}
if let Some(ExecuteInvocation::Ok(fn_invocation)) = &mut self.execute_invocation {
fn_invocation.make_legacy()
}
if let Some(invocation) = &mut self.fee_transfer_invocation {
invocation.make_legacy()
}
if let Some(invocation) = &mut self.constructor_invocation {
invocation.make_legacy()
}
if let Some(invocation) = &mut self.function_invocation {
invocation.make_legacy()
}
}
}

#[derive(Serialize)]
struct StateDiff {
storage_diffs: Vec<StorageDiff>,
Expand Down Expand Up @@ -227,7 +250,14 @@ pub struct FunctionInvocation {
pub calls: Vec<FunctionInvocation>,
pub events: Vec<OrderedEvent>,
pub messages: Vec<OrderedMessage>,
pub execution_resources: ExecutionResources,
#[serde(skip_serializing_if = "Option::is_none")]
pub execution_resources: Option<ExecutionResources>,
}

impl FunctionInvocation {
fn make_legacy(&mut self) {
self.execution_resources = None
}
}

use blockifier::execution::call_info::CallInfo as BlockifierCallInfo;
Expand Down Expand Up @@ -260,7 +290,7 @@ impl From<BlockifierCallInfo> for FunctionInvocation {
ordered_message
})
.collect(),
execution_resources: val.vm_resources.into(),
execution_resources: Some(val.vm_resources.into()),
}
}
}
Expand Down

0 comments on commit 5db77ad

Please sign in to comment.