Skip to content

Commit

Permalink
Fix issue with failing gas counter
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus committed Jan 24, 2025
1 parent a80067d commit 0c5416b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/cairo-lang-runner/src/casm_run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ impl CairoHintProcessor<'_> {
let system_ptr = extract_relocatable(vm, system)?;
let mut system_buffer = MemBuffer::new(vm, system_ptr);
let selector = system_buffer.next_felt252()?.to_bytes_be();
let mut gas_counter = system_buffer.next_usize()?;
let _ = system_buffer.next();
let mut gas_counter = 9999999999; //system_buffer.next_usize()?;
let mut execute_handle_helper =
|handler: &mut dyn FnMut(
// The syscall buffer.
Expand All @@ -662,12 +663,12 @@ impl CairoHintProcessor<'_> {
) -> Result<SyscallResult, HintError>| {
match handler(&mut system_buffer, &mut gas_counter)? {
SyscallResult::Success(values) => {
system_buffer.write(gas_counter)?;
system_buffer.write(0)?;
system_buffer.write(Felt252::from(0))?;
system_buffer.write_data(values.into_iter())?;
}
SyscallResult::Failure(revert_reason) => {
system_buffer.write(gas_counter)?;
system_buffer.write(0)?;
system_buffer.write(Felt252::from(1))?;
system_buffer.write_arr(revert_reason.into_iter())?;
}
Expand Down

0 comments on commit 0c5416b

Please sign in to comment.