Skip to content

Commit

Permalink
fix: make sure accumulator coordinates are less than base field modulus
Browse files Browse the repository at this point in the history
  • Loading branch information
han0110 committed Feb 2, 2024
1 parent 2ab5ecf commit 43dada6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/Halo2Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ contract Halo2Verifier {
shift := add(shift, num_limb_bits)
}

success := and(success, and(lt(lhs_x, q), lt(lhs_y, q)))
success := and(success, eq(mulmod(lhs_y, lhs_y, q), addmod(mulmod(lhs_x, mulmod(lhs_x, lhs_x, q), q), 3, q)))
success := and(success, and(lt(rhs_x, q), lt(rhs_y, q)))
success := and(success, eq(mulmod(rhs_y, rhs_y, q), addmod(mulmod(rhs_x, mulmod(rhs_x, rhs_x, q), q), 3, q)))

mstore(ACC_LHS_X_MPTR, lhs_x)
Expand Down

0 comments on commit 43dada6

Please sign in to comment.