diff --git a/crates/blockifier/src/execution/native/syscall_handler.rs b/crates/blockifier/src/execution/native/syscall_handler.rs index 2f643d3879..42095370f6 100644 --- a/crates/blockifier/src/execution/native/syscall_handler.rs +++ b/crates/blockifier/src/execution/native/syscall_handler.rs @@ -266,7 +266,7 @@ impl<'state> StarknetSyscallHandler for &mut NativeSyscallHandler<'state> { match syscall_base::get_block_hash_base(self.context, block_number, self.state) { Ok(value) => Ok(value), - Err(e) => Err(self.handle_error(remaining_gas, e.into())), + Err(e) => Err(self.handle_error(remaining_gas, e)), } } @@ -411,8 +411,7 @@ impl<'state> StarknetSyscallHandler for &mut NativeSyscallHandler<'state> { storage_address: self.call.storage_address, caller_address: self.call.caller_address, call_type: CallType::Delegate, - initial_gas: u64::try_from(*remaining_gas) - .expect("Failed to convert gas (u128 -> u64)"), + initial_gas: *remaining_gas, }; Ok(self.execute_inner_call(entry_point, remaining_gas)?.0) @@ -450,8 +449,7 @@ impl<'state> StarknetSyscallHandler for &mut NativeSyscallHandler<'state> { storage_address: contract_address, caller_address: self.call.caller_address, call_type: CallType::Call, - initial_gas: u64::try_from(*remaining_gas) - .expect("Failed to convert gas from u128 to u64."), + initial_gas: *remaining_gas, }; Ok(self.execute_inner_call(entry_point, remaining_gas)?.0) @@ -578,9 +576,8 @@ impl<'state> StarknetSyscallHandler for &mut NativeSyscallHandler<'state> { // TODO(Ori, 1/2/2024): Write an indicative expect message explaining why the conversion // works. - let n_rounds_as_u128 = u64::try_from(n_rounds).expect("Failed to convert usize to u128."); - let gas_cost = - n_rounds_as_u128 * u64::from(self.context.gas_costs().keccak_round_cost_gas_cost); + let n_rounds = u64::try_from(n_rounds).expect("Failed to convert usize to u64."); + let gas_cost = n_rounds * self.context.gas_costs().keccak_round_cost_gas_cost; if gas_cost > *remaining_gas { return Err(self.handle_error( diff --git a/crates/blockifier/src/fee/gas_usage_test.rs b/crates/blockifier/src/fee/gas_usage_test.rs index 10cdb2c96d..4b2809502b 100644 --- a/crates/blockifier/src/fee/gas_usage_test.rs +++ b/crates/blockifier/src/fee/gas_usage_test.rs @@ -70,7 +70,7 @@ fn starknet_resources() -> StarknetResources { .map(|call_info| call_info.with_some_class_hash()) .collect(); let execution_summary = - CallInfo::summarize_many(call_infos.iter(), &VersionedConstants::latest_constants()); + CallInfo::summarize_many(call_infos.iter(), VersionedConstants::latest_constants()); let state_resources = StateResources::new_for_testing(StateChangesCount { n_storage_updates: 7, n_class_hash_updates: 11, diff --git a/crates/blockifier/src/fee/receipt_test.rs b/crates/blockifier/src/fee/receipt_test.rs index 5b4286ce34..b15916a12c 100644 --- a/crates/blockifier/src/fee/receipt_test.rs +++ b/crates/blockifier/src/fee/receipt_test.rs @@ -432,7 +432,7 @@ fn test_calculate_tx_gas_usage( let execution_call_info = &tx_execution_info.execute_call_info.expect("Execution call info should exist."); let execution_summary = - CallInfo::summarize_many(vec![execution_call_info].into_iter(), &versioned_constants); + CallInfo::summarize_many(vec![execution_call_info].into_iter(), versioned_constants); let starknet_resources = StarknetResources::new( calldata_length, signature_length, diff --git a/crates/blockifier/src/test_utils/contracts.rs b/crates/blockifier/src/test_utils/contracts.rs index bf572839f0..7a4bb8fa93 100644 --- a/crates/blockifier/src/test_utils/contracts.rs +++ b/crates/blockifier/src/test_utils/contracts.rs @@ -189,7 +189,7 @@ impl FeatureContract { #[cfg(feature = "cairo_native")] if CairoVersion::Native == self.cairo_version() { let native_contract_class = - NativeContractClassV1::compile_or_get_cached(&self.get_compiled_path()).into(); + NativeContractClassV1::compile_or_get_cached(&self.get_compiled_path()); return RunnableContractClass::V1Native(native_contract_class); } diff --git a/crates/blockifier/src/transaction/objects_test.rs b/crates/blockifier/src/transaction/objects_test.rs index d736adb89c..29ef00aed6 100644 --- a/crates/blockifier/src/transaction/objects_test.rs +++ b/crates/blockifier/src/transaction/objects_test.rs @@ -139,7 +139,7 @@ fn test_events_counter_in_tx_execution_info( }; assert_eq!( - tx_execution_info.summarize(&VersionedConstants::latest_constants()).event_summary.n_events, + tx_execution_info.summarize(VersionedConstants::latest_constants()).event_summary.n_events, n_validate_events + n_execute_events + n_fee_transfer_events + n_inner_calls ); }