From 0e20d91c2847a79ae08c92ec32219b9b8873a846 Mon Sep 17 00:00:00 2001 From: Vaclav Barta Date: Fri, 17 Jan 2025 11:33:08 +0100 Subject: [PATCH 1/2] fix: sending l1 data gas to gateway --- crates/gateway-types/src/reply.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/gateway-types/src/reply.rs b/crates/gateway-types/src/reply.rs index f44f647f03..08e71e9585 100644 --- a/crates/gateway-types/src/reply.rs +++ b/crates/gateway-types/src/reply.rs @@ -856,8 +856,7 @@ pub mod transaction { Self { l1_gas: value.l1_gas.into(), l2_gas: value.l2_gas.into(), - // TODO: add this when adding support for Starknet 0.13.4 - l1_data_gas: None, + l1_data_gas: value.l1_data_gas.map(|g| g.into()), } } } From 64daa18c02ae91e5d914a957f1c64544a3113685 Mon Sep 17 00:00:00 2001 From: Vaclav Barta Date: Fri, 17 Jan 2025 13:36:35 +0100 Subject: [PATCH 2/2] using L2 gas if present in FunctionInvocation --- crates/rpc/src/method/trace_block_transactions.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/rpc/src/method/trace_block_transactions.rs b/crates/rpc/src/method/trace_block_transactions.rs index 78c32e7010..3ba2c6dbf2 100644 --- a/crates/rpc/src/method/trace_block_transactions.rs +++ b/crates/rpc/src/method/trace_block_transactions.rs @@ -426,6 +426,10 @@ pub(crate) fn map_gateway_trace( fn map_gateway_function_invocation( invocation: starknet_gateway_types::trace::FunctionInvocation, ) -> anyhow::Result { + let gas_consumed = invocation + .execution_resources + .total_gas_consumed + .unwrap_or_default(); Ok(pathfinder_executor::types::FunctionInvocation { calldata: invocation.calldata, contract_address: invocation.contract_address, @@ -486,13 +490,8 @@ fn map_gateway_function_invocation( result: invocation.result, computation_resources: map_gateway_computation_resources(invocation.execution_resources), execution_resources: InnerCallExecutionResources { - l1_gas: invocation - .execution_resources - .total_gas_consumed - .map(|gas| gas.l1_gas) - .unwrap_or_default(), - // TODO: Use proper l1_gas value for Starknet 0.13.3 - l2_gas: 0, + l1_gas: gas_consumed.l1_gas, + l2_gas: gas_consumed.l2_gas.unwrap_or_default(), }, }) }