diff --git a/vm/rust/src/jsonrpc.rs b/vm/rust/src/jsonrpc.rs index 3e5778a0f6..746cd45ab8 100644 --- a/vm/rust/src/jsonrpc.rs +++ b/vm/rust/src/jsonrpc.rs @@ -49,6 +49,29 @@ pub struct TransactionTrace { state_diff: Option, } + +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, @@ -227,7 +250,14 @@ pub struct FunctionInvocation { pub calls: Vec, pub events: Vec, pub messages: Vec, - pub execution_resources: ExecutionResources, + #[serde(skip_serializing_if = "Option::is_none")] + pub execution_resources: Option, +} + +impl FunctionInvocation { + fn make_legacy(&mut self) { + self.execution_resources = None + } } use blockifier::execution::call_info::CallInfo as BlockifierCallInfo; @@ -260,7 +290,7 @@ impl From for FunctionInvocation { ordered_message }) .collect(), - execution_resources: val.vm_resources.into(), + execution_resources: Some(val.vm_resources.into()), } } }