Skip to content

Commit

Permalink
using L2 gas if present in FunctionInvocation
Browse files Browse the repository at this point in the history
  • Loading branch information
vbar committed Jan 17, 2025
1 parent 0e20d91 commit 5840ca0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/rpc/src/method/trace_block_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ pub(crate) fn map_gateway_trace(
fn map_gateway_function_invocation(
invocation: starknet_gateway_types::trace::FunctionInvocation,
) -> anyhow::Result<pathfinder_executor::types::FunctionInvocation> {
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,
Expand Down Expand Up @@ -486,13 +487,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(),
},
})
}
Expand Down

0 comments on commit 5840ca0

Please sign in to comment.