Skip to content

Commit

Permalink
fix: Groth16Verifier solidity scalar size check.
Browse files Browse the repository at this point in the history
The Groth16Verifier contract is not correctly generating codes to
checking that public signals that with the scalar field's range.
Signals should be less than r instead of q in the contract's context.
  • Loading branch information
Stumble committed Apr 5, 2024
1 parent e44656d commit 8035774
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/verifier_groth16.sol.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract Groth16Verifier {
function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[<%=IC.length-1%>] calldata _pubSignals) public view returns (bool) {
assembly {
function checkField(v) {
if iszero(lt(v, q)) {
if iszero(lt(v, r)) {
mstore(0, 0)
return(0, 0x20)
}
Expand Down

0 comments on commit 8035774

Please sign in to comment.