Skip to content

Commit de5e835

Browse files
fix: Handle decompression with x = 0 correctly
1 parent a67e46d commit de5e835

File tree

1 file changed

+4
-0
lines changed
  • extensions/ecc/te-macros/src

1 file changed

+4
-0
lines changed

extensions/ecc/te-macros/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ pub fn te_declare(input: TokenStream) -> TokenStream {
247247
} else {
248248
-x
249249
};
250+
// handle the case where x = 0
251+
if correct_x.as_le_bytes()[0] & 1 != *rec_id & 1 {
252+
return None;
253+
}
250254
// In order for sqrt() to return Some, we are guaranteed that x * x == x_squared, which already proves (correct_x, y) is on the curve
251255
Some(<#struct_name as ::openvm_ecc_guest::edwards::TwistedEdwardsPoint>::from_xy_unchecked(correct_x, y))
252256
}

0 commit comments

Comments
 (0)