Skip to content

Commit 51d8ba9

Browse files
committed
move static_cost_native to test only
1 parent 7daec93 commit 51d8ba9

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

clarity/src/vm/costs/analysis.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,6 @@ fn make_ast(
205205
Ok(ast)
206206
}
207207

208-
/// somewhat of a passthrough since we don't have to build the whole context we
209-
/// can jsut return the cost of the single expression
210-
fn static_cost_native(
211-
source: &str,
212-
cost_map: &HashMap<String, Option<StaticCost>>,
213-
clarity_version: &ClarityVersion,
214-
) -> Result<StaticCost, String> {
215-
let epoch = StacksEpochId::latest(); // XXX this should be matched with the clarity version
216-
let ast = make_ast(source, epoch, clarity_version)?;
217-
let exprs = &ast.expressions;
218-
let user_args = UserArgumentsContext::new();
219-
let expr = &exprs[0];
220-
let (_, cost_analysis_tree) =
221-
build_cost_analysis_tree(&expr, &user_args, cost_map, clarity_version)?;
222-
223-
let summing_cost = calculate_total_cost_with_branching(&cost_analysis_tree);
224-
Ok(summing_cost.into())
225-
}
226-
227208
/// STatic execution cost for functions within Environment
228209
/// returns the top level cost for specific functions
229210
/// {function_name: cost}
@@ -604,7 +585,17 @@ mod tests {
604585
clarity_version: &ClarityVersion,
605586
) -> Result<StaticCost, String> {
606587
let cost_map: HashMap<String, Option<StaticCost>> = HashMap::new();
607-
static_cost_native(source, &cost_map, clarity_version)
588+
589+
let epoch = StacksEpochId::latest(); // XXX this should be matched with the clarity version
590+
let ast = make_ast(source, epoch, clarity_version)?;
591+
let exprs = &ast.expressions;
592+
let user_args = UserArgumentsContext::new();
593+
let expr = &exprs[0];
594+
let (_, cost_analysis_tree) =
595+
build_cost_analysis_tree(&expr, &user_args, &cost_map, clarity_version)?;
596+
597+
let summing_cost = calculate_total_cost_with_branching(&cost_analysis_tree);
598+
Ok(summing_cost.into())
608599
}
609600

610601
fn static_cost_test(

0 commit comments

Comments
 (0)