@@ -264,21 +264,54 @@ impl From<katana_primitives::receipt::Receipt> for ReceiptBody {
264264 Some ( ExecutionStatus :: Succeeded )
265265 } ;
266266
267- let execution_resources = Some ( ExecutionResources {
268- vm_resources : receipt. resources_used ( ) . computation_resources . clone ( ) ,
269- data_availability : Some ( receipt. resources_used ( ) . da_resources . clone ( ) ) ,
270- total_gas_consumed : Some ( receipt. resources_used ( ) . gas . clone ( ) ) ,
271- } ) ;
267+ match receipt {
268+ katana_primitives:: receipt:: Receipt :: Invoke ( receipt) => {
269+ Self {
270+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
271+ // This would need to be populated from transaction context
272+ l1_to_l2_consumed_message : None ,
273+ l2_to_l1_messages : receipt. messages_sent ,
274+ events : receipt. events ,
275+ actual_fee : receipt. fee . overall_fee . into ( ) ,
276+ execution_status,
277+ revert_error : receipt. revert_error ,
278+ }
279+ }
272280
273- Self {
274- execution_resources,
275- l1_to_l2_consumed_message : None , /* This would need to be populated from transaction
276- * context */
277- l2_to_l1_messages : receipt. messages_sent ( ) . to_vec ( ) ,
278- events : receipt. events ( ) . to_vec ( ) ,
279- actual_fee : receipt. fee ( ) . overall_fee . into ( ) ,
280- execution_status,
281- revert_error : receipt. revert_reason ( ) . map ( |s| s. to_string ( ) ) ,
281+ katana_primitives:: receipt:: Receipt :: Declare ( receipt) => Self {
282+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
283+ // This would need to be populated from transaction context
284+ l1_to_l2_consumed_message : None ,
285+ l2_to_l1_messages : receipt. messages_sent ,
286+ events : receipt. events ,
287+ actual_fee : receipt. fee . overall_fee . into ( ) ,
288+ execution_status,
289+ revert_error : receipt. revert_error ,
290+ } ,
291+
292+ katana_primitives:: receipt:: Receipt :: DeployAccount ( receipt) => {
293+ Self {
294+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
295+ // This would need to be populated from transaction context
296+ l1_to_l2_consumed_message : None ,
297+ l2_to_l1_messages : receipt. messages_sent ,
298+ events : receipt. events ,
299+ actual_fee : receipt. fee . overall_fee . into ( ) ,
300+ execution_status,
301+ revert_error : receipt. revert_error ,
302+ }
303+ }
304+
305+ katana_primitives:: receipt:: Receipt :: L1Handler ( receipt) => Self {
306+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
307+ // This would need to be populated from transaction context
308+ l1_to_l2_consumed_message : None ,
309+ l2_to_l1_messages : receipt. messages_sent ,
310+ events : receipt. events ,
311+ actual_fee : receipt. fee . overall_fee . into ( ) ,
312+ execution_status,
313+ revert_error : receipt. revert_error ,
314+ } ,
282315 }
283316 }
284317}
@@ -340,6 +373,26 @@ impl From<StateDiff> for katana_primitives::state::StateUpdates {
340373 }
341374}
342375
376+ impl From < katana_primitives:: receipt:: ExecutionResources > for ExecutionResources {
377+ fn from ( value : katana_primitives:: receipt:: ExecutionResources ) -> Self {
378+ Self {
379+ vm_resources : value. vm_resources ,
380+ data_availability : Some ( value. data_availability ) ,
381+ total_gas_consumed : Some ( value. total_gas_consumed ) ,
382+ }
383+ }
384+ }
385+
386+ impl From < ExecutionResources > for katana_primitives:: receipt:: ExecutionResources {
387+ fn from ( value : ExecutionResources ) -> Self {
388+ Self {
389+ vm_resources : value. vm_resources ,
390+ data_availability : value. data_availability . unwrap_or_default ( ) ,
391+ total_gas_consumed : value. total_gas_consumed . unwrap_or_default ( ) ,
392+ }
393+ }
394+ }
395+
343396#[ cfg( test) ]
344397mod from_primitives_test {
345398 use katana_primitives:: transaction:: TxWithHash ;
0 commit comments