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

Change additional as to try_from and try_to #1342

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions crates/blockifier/src/execution/entry_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ impl EntryPointExecutionContext {
// transactions derive this value from the `max_fee`.
let tx_gas_upper_bound = match account_tx_context {
AccountTransactionContext::Deprecated(context) => {
(context.max_fee.0
let max_cairo_steps = context.max_fee.0
/ block_context
.gas_prices
.get_gas_price_by_fee_type(&account_tx_context.fee_type()))
as usize
.get_gas_price_by_fee_type(&account_tx_context.fee_type());
// TODO(Ori, 1/2/2024): Write an indicative expect message explaining why the
// conversion works.
usize::try_from(max_cairo_steps).expect("Failed to convert u128 to usize")
}
AccountTransactionContext::Current(context) => {
context.l1_resource_bounds()?.max_amount as usize
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/execution/syscalls/hint_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ fn get_ptr_from_res_operand_unchecked(vm: &mut VirtualMachine, res: &ResOperand)
Register::AP => vm.get_ap(),
Register::FP => vm.get_fp(),
};
let cell_reloc = (base + (cell.offset as i32)).unwrap();
let cell_reloc = (base + (i32::from(cell.offset))).unwrap();
(vm.get_relocatable(cell_reloc).unwrap() + &base_offset).unwrap()
}

Expand Down
Loading