Skip to content

Commit

Permalink
Add rought version of VirtualMachineError::Hint
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Dec 29, 2022
1 parent bd6111a commit a9045fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/vm/errors/vm_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,6 @@ pub enum VirtualMachineError {
InvalidArgCount(usize, usize),
#[error("{0}, {1}")]
ErrorMessageAttribute(String, Box<VirtualMachineError>),
#[error("{1}")]
Hint(usize, Box<VirtualMachineError>),
}
6 changes: 4 additions & 2 deletions src/vm/vm_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,10 @@ impl VirtualMachine {
constants: &HashMap<String, BigInt>,
) -> Result<(), VirtualMachineError> {
if let Some(hint_list) = hint_data_dictionary.get(&self.run_context.pc.offset) {
for hint_data in hint_list.iter() {
hint_executor.execute_hint(self, exec_scopes, hint_data, constants)?
for (hint_index, hint_data) in hint_list.iter().enumerate() {
hint_executor
.execute_hint(self, exec_scopes, hint_data, constants)
.map_err(|err| VirtualMachineError::Hint(hint_index, Box::new(err)))?
}
}
Ok(())
Expand Down

1 comment on commit a9045fa

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: a9045fa Previous: 34e2a4a Ratio
cairo_run(cairo_programs/benchmarks/memory_integration_benchmark.json 1431519588 ns/iter (± 66079514) 1098971820 ns/iter (± 8313907) 1.30
cairo_run(cairo_programs/benchmarks/uint256_integration_benchmark.json 3321351738 ns/iter (± 69346913) 2491213460 ns/iter (± 6794363) 1.33

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.