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

style(fee): fix error handle unpack #1390

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading