Skip to main content

binius_frontend/eval_form/
assertion.rs

1// Copyright 2026 The Binius Developers
2//! What the single-instance and batched execution contexts share about assertion failures.
3
4use crate::ir::path::{PathSpec, PathSpecTree};
5
6/// The cap on how many assertion failures an execution context retains.
7///
8/// Failures past the cap are counted but not stored.
9pub const MAX_ASSERTION_FAILURES: usize = 100;
10
11/// Renders the circuit path an assertion was raised under.
12///
13/// Empty when no tree is available to resolve the path, or when the assertion sits at the root.
14/// The path is kept apart from the failure detail so a caller can group failures by subcircuit.
15pub fn render_path(path_spec_tree: Option<&PathSpecTree>, path_spec: PathSpec) -> String {
16	let Some(tree) = path_spec_tree else {
17		return String::new();
18	};
19
20	let mut path = String::new();
21	tree.stringify(path_spec, &mut path);
22	path
23}