@@ -253,21 +253,54 @@ impl From<katana_primitives::receipt::Receipt> for ReceiptBody {
253253 Some ( ExecutionStatus :: Succeeded )
254254 } ;
255255
256- let execution_resources = Some ( ExecutionResources {
257- vm_resources : receipt. resources_used ( ) . computation_resources . clone ( ) ,
258- data_availability : Some ( receipt. resources_used ( ) . da_resources . clone ( ) ) ,
259- total_gas_consumed : Some ( receipt. resources_used ( ) . gas . clone ( ) ) ,
260- } ) ;
256+ match receipt {
257+ katana_primitives:: receipt:: Receipt :: Invoke ( receipt) => {
258+ Self {
259+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
260+ // This would need to be populated from transaction context
261+ l1_to_l2_consumed_message : None ,
262+ l2_to_l1_messages : receipt. messages_sent ,
263+ events : receipt. events ,
264+ actual_fee : receipt. fee . overall_fee . into ( ) ,
265+ execution_status,
266+ revert_error : receipt. revert_error ,
267+ }
268+ }
261269
262- Self {
263- execution_resources,
264- l1_to_l2_consumed_message : None , /* This would need to be populated from transaction
265- * context */
266- l2_to_l1_messages : receipt. messages_sent ( ) . to_vec ( ) ,
267- events : receipt. events ( ) . to_vec ( ) ,
268- actual_fee : receipt. fee ( ) . overall_fee . into ( ) ,
269- execution_status,
270- revert_error : receipt. revert_reason ( ) . map ( |s| s. to_string ( ) ) ,
270+ katana_primitives:: receipt:: Receipt :: Declare ( receipt) => Self {
271+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
272+ // This would need to be populated from transaction context
273+ l1_to_l2_consumed_message : None ,
274+ l2_to_l1_messages : receipt. messages_sent ,
275+ events : receipt. events ,
276+ actual_fee : receipt. fee . overall_fee . into ( ) ,
277+ execution_status,
278+ revert_error : receipt. revert_error ,
279+ } ,
280+
281+ katana_primitives:: receipt:: Receipt :: DeployAccount ( receipt) => {
282+ Self {
283+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
284+ // This would need to be populated from transaction context
285+ l1_to_l2_consumed_message : None ,
286+ l2_to_l1_messages : receipt. messages_sent ,
287+ events : receipt. events ,
288+ actual_fee : receipt. fee . overall_fee . into ( ) ,
289+ execution_status,
290+ revert_error : receipt. revert_error ,
291+ }
292+ }
293+
294+ katana_primitives:: receipt:: Receipt :: L1Handler ( receipt) => Self {
295+ execution_resources : Some ( receipt. execution_resources . into ( ) ) ,
296+ // This would need to be populated from transaction context
297+ l1_to_l2_consumed_message : None ,
298+ l2_to_l1_messages : receipt. messages_sent ,
299+ events : receipt. events ,
300+ actual_fee : receipt. fee . overall_fee . into ( ) ,
301+ execution_status,
302+ revert_error : receipt. revert_error ,
303+ } ,
271304 }
272305 }
273306}
@@ -322,6 +355,26 @@ impl From<StateDiff> for katana_primitives::state::StateUpdates {
322355 }
323356}
324357
358+ impl From < katana_primitives:: receipt:: ExecutionResources > for ExecutionResources {
359+ fn from ( value : katana_primitives:: receipt:: ExecutionResources ) -> Self {
360+ Self {
361+ vm_resources : value. vm_resources ,
362+ data_availability : Some ( value. data_availability ) ,
363+ total_gas_consumed : Some ( value. total_gas_consumed ) ,
364+ }
365+ }
366+ }
367+
368+ impl From < ExecutionResources > for katana_primitives:: receipt:: ExecutionResources {
369+ fn from ( value : ExecutionResources ) -> Self {
370+ Self {
371+ vm_resources : value. vm_resources ,
372+ data_availability : value. data_availability . unwrap_or_default ( ) ,
373+ total_gas_consumed : value. total_gas_consumed . unwrap_or_default ( ) ,
374+ }
375+ }
376+ }
377+
325378#[ cfg( test) ]
326379mod from_primitives_test {
327380 use katana_primitives:: transaction:: TxWithHash ;
0 commit comments