Skip to content

Commit

Permalink
Transaction resources (#648)
Browse files Browse the repository at this point in the history
* exclude memory holes comming from fee transfer info

* clippy
  • Loading branch information
marioiordanov authored Nov 21, 2024
1 parent 0502b44 commit db611ec
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions crates/starknet-devnet-types/src/rpc/transaction_receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,11 @@ impl From<&blockifier::execution::call_info::CallInfo> for ComputationResources

impl From<&blockifier::transaction::objects::TransactionExecutionInfo> for ExecutionResources {
fn from(execution_info: &blockifier::transaction::objects::TransactionExecutionInfo) -> Self {
let total_memory_holes = ComputationResources::get_memory_holes_from_call_info(
&execution_info.execute_call_info,
) + ComputationResources::get_memory_holes_from_call_info(
&execution_info.validate_call_info,
) + ComputationResources::get_memory_holes_from_call_info(
&execution_info.fee_transfer_call_info,
);
let memory_holes = execution_info.transaction_receipt.resources.vm_resources.n_memory_holes;

let computation_resources = ComputationResources {
steps: execution_info.transaction_receipt.resources.total_charged_steps(),
memory_holes: if total_memory_holes == 0 { None } else { Some(total_memory_holes) },
memory_holes: if memory_holes == 0 { None } else { Some(memory_holes) },
range_check_builtin_applications:
ComputationResources::get_resource_from_execution_info(
execution_info,
Expand Down Expand Up @@ -227,12 +221,6 @@ impl From<&blockifier::transaction::objects::TransactionExecutionInfo> for Execu
}

impl ComputationResources {
fn get_memory_holes_from_call_info(
call_info: &Option<blockifier::execution::call_info::CallInfo>,
) -> usize {
if let Some(call) = call_info { call.resources.n_memory_holes } else { 0 }
}

fn get_resource_from_execution_info(
execution_info: &blockifier::transaction::objects::TransactionExecutionInfo,
resource_name: &BuiltinName,
Expand Down

0 comments on commit db611ec

Please sign in to comment.