Skip to main content

invalid_hint

Macro invalid_hint 

Source
macro_rules! invalid_hint {
    () => { ... };
    ($($arg:tt)*) => { ... };
}
Expand description

Halts the zkVM with exit code 3 (invalid prover hint), optionally writing a formatted diagnostic to stderr first.

Format-arg syntax matches panic!, but exit code 3 disambiguates hint-validation failures from regular panics (exit code 1) — a malicious prover cannot forge a panicked-program proof by feeding wrong hints. Patches should reach for this on any hint check that would otherwise panic.

sp1_lib::invalid_hint!();                                    // no message
sp1_lib::invalid_hint!("Fp inverse hint mismatch");
sp1_lib::invalid_hint!("expected {} bytes, got {}", expected, got);