Skip to content

Commit

Permalink
Remove redundant gas assertions. (#4464)
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored Nov 23, 2023
1 parent cf13ecc commit 46b323d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 57 deletions.
82 changes: 41 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions crates/cairo-lang-sierra-to-casm/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@ pub fn calc_metadata(
)
})
.collect();
let pre_gas_info = calc_gas_precost_info(program, pre_function_set_costs)?;
let pre_gas_info2 = compute_precost_info(program)?;
pre_gas_info.assert_eq_variables(&pre_gas_info2);
pre_gas_info.assert_eq_functions(&pre_gas_info2);
let pre_gas_info_new = compute_precost_info(program)?;
let pre_gas_info_old = calc_gas_precost_info(program, pre_function_set_costs)?;
pre_gas_info_old.assert_eq_functions(&pre_gas_info_new);
let pre_gas_info = if config.linear_gas_solver {
pre_gas_info_new
} else {
pre_gas_info_old.assert_eq_variables(&pre_gas_info_new);
pre_gas_info_old
};

let ap_change_info =
if config.linear_ap_change_solver { linear_calc_ap_changes } else { calc_ap_changes }(
Expand Down Expand Up @@ -122,7 +127,7 @@ pub fn calc_metadata(
let post_gas_info2 = compute_postcost_info(
program,
&|idx| ap_change_info.variable_values.get(idx).copied().unwrap_or_default(),
&pre_gas_info2,
&pre_gas_info,
&enforced_function_costs,
)?;

Expand Down
Loading

0 comments on commit 46b323d

Please sign in to comment.