Skip to content

Commit 43c2d41

Browse files
Fix security error message
1 parent 399c14c commit 43c2d41

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vm/src/vm/runners/builtin_runner/modulo.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ pub enum ModBuiltinType {
5656
Add,
5757
}
5858

59+
impl ModBuiltinType {
60+
pub(crate) fn operation_string(&self) -> &'static str {
61+
match self {
62+
ModBuiltinType::Mul => "*",
63+
ModBuiltinType::Add => "+",
64+
}
65+
}
66+
}
67+
5968
#[derive(Debug, Default)]
6069
struct Inputs {
6170
p: BigUint,
@@ -612,8 +621,8 @@ impl ModBuiltinRunner {
612621
if a_op_b.mod_floor(&inputs.p) != c.mod_floor(&inputs.p) {
613622
// Build error string
614623
let p = inputs.p;
615-
let op = &self.builtin_type;
616-
let error_string = format!("Expected a {op:?} b == c (mod p). Got: instance={instance}, batch={index_in_batch}, p={p}, a={a}, b={b}, c={c}.");
624+
let op = self.builtin_type.operation_string();
625+
let error_string = format!("Expected a {op} b == c (mod p). Got: instance={instance}, batch={index_in_batch}, p={p}, a={a}, b={b}, c={c}.");
617626
return Err(RunnerError::ModBuiltinSecurityCheck(Box::new((
618627
self.name(),
619628
error_string,

0 commit comments

Comments
 (0)