Missing Public Inputs Range Check
The public input is an array of `uint256` numbers, there is no check if each public input is less than SNARK scalar field modulus `r_mod`, as mentioned in the step 3 of the verifier's algorithm in the Plonk paper. Since public inputs are involved computation of `Pi` in the plonk gate which is in the SNARK scalar field, without the check, it might cause scalar field overflow and the verification contract would fail and revert. To prevent overflow and other unintended behavior there should be a range check for the public inputs.\\n```\\nfunction Verify(bytes memory proof, uint256[] memory public\\_inputs)\\n```\\n\\n```\\nsum\\_pi\\_wo\\_api\\_commit(add(public\\_inputs,0x20), mload(public\\_inputs), zeta)\\npi := mload(mload(0x40))\\n\\nfunction sum\\_pi\\_wo\\_api\\_commit(ins, n, z) {\\n let li := mload(0x40)\\n batch\\_compute\\_lagranges\\_at\\_z(z, n, li)\\n let res := 0\\n let tmp := 0\\n for {let i:=0} lt(i,n) {i:=add(i,1)}\\n {\\n tmp := mulmod(mload(li), mload(ins), r\\_mod)\\n res := addmod(res, tmp, r\\_mod)\\n li := add(li, 0x20)\\n ins := add(ins, 0x20)\\n }\\n mstore(mload(0x40), res)\\n}\\n```\\n
Add range check for the public inputs `require(input[i] < r_mod, "public inputs greater than snark scalar field");`
```\\nfunction Verify(bytes memory proof, uint256[] memory public\\_inputs)\\n```\\n