Skip to content

Commit

Permalink
Revert initial gas check fix. (#356)
Browse files Browse the repository at this point in the history
* Revert fix.

* Implement `class_hash_const`.

* Implement `snapshot_deconstruct`.

---------

Co-authored-by: Edgar Luque <[email protected]>
  • Loading branch information
azteca1998 and edg-l authored Dec 20, 2023
1 parent afae1f3 commit d5b73f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ impl<'m> NativeExecutor<'m> {
.ok_or(RunnerError::from(ErrorImpl::MissingSyscallHandler))?;

// Note: It appears this isn't being checked when running contracts on the VM.
let required_initial_gas = (gas != 0)
.then_some(self.native_module.get_required_init_gas(fn_id))
.flatten();
// let required_initial_gas = self.native_module.get_required_init_gas(fn_id);

execute_contract(
&self.engine,
registry,
fn_id,
calldata,
None,
required_initial_gas,
gas,
syscall_handler,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/starknet/keccak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,6 @@ fn keccak_test() {
run_native_starknet_contract(&program, entry_point.function_idx, &[], &mut SyscallHandler);

assert!(!result.failure_flag);
assert_eq!(result.remaining_gas, 18446744073709422805);
assert_eq!(result.remaining_gas, 18446744073709421435);
assert_eq!(result.return_values, vec![1.into()]);
}

0 comments on commit d5b73f2

Please sign in to comment.