Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
style(fee): fix error handle unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Jan 28, 2024
1 parent 93c0eaa commit cc63d77
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/blockifier/src/transaction/transaction_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ pub fn calculate_tx_weights(
) -> Result<ResourcesMap, TransactionExecutionError> {
let mut tx_weights: HashMap<String, usize> = HashMap::new();
let mut cairo_resource_usage: HashMap<String, usize> = actual_resources;
if let Some(value) = cairo_resource_usage.remove("l1_gas_usage") {
tx_weights.insert("gas_weight".to_string(), value);
} else {
return Err(TransactionExecutionError::InvalidTransactionExecutionInfo {
let value = cairo_resource_usage.remove("l1_gas_usage").ok_or(
TransactionExecutionError::InvalidTransactionExecutionInfo {
field: "l1_gas_usage".to_string(),
});
}
},
)?;
tx_weights.insert("gas_weight".to_string(), value);
let os_cairo_usage: HashMap<String, usize> =
vm_execution_resources_to_hash_map(additional_os_resources);
let cairo_usage = merge_hashmaps(&cairo_resource_usage, &os_cairo_usage);
Expand Down

0 comments on commit cc63d77

Please sign in to comment.