12 commits in all time
Mar 19, 2026 10:26 – Jun 17, 2026 10:26 UTC
feat: support single BSB22 commitment in BN254 smart-contract verifier
Extend the PuyaPy BN254 verifier generator to support circuits that emit
exactly one BSB22 commitment (gnark custom gate), as produced by gnark's
range-checker for emulated arithmetic (e.g. RSA-2048 + SHA-256). Previously
WritePythonCode rejected any commitment with "custom gates are not supported".
The single-commitment folding mirrors gnark's own audited Solidity PLONK
verifier (backend/plonk/bn254/solidity.go), term for term:
- bind VK_QCP into the gamma challenge (after Qk, before public inputs)
- bind the commitment point into the alpha challenge (before [Z])
- PI += hash_to_field(commitment) * L_{nbPublic+commitIndex}(zeta)
- fold commitment * qcp(zeta) into the linearised polynomial digest
- bind VK_QCP + qcp(zeta) into the KZG folding (gamma_kzg) challenge
- fold VK_QCP into the batch opening accumulation
A hash_to_field subroutine implements RFC 9380 expand_message_xmd(SHA-256),
L=48, reduced mod r (matching the prover's fr.Hash over the uncompressed
commitment). Circuits with >1 commitment remain rejected.
Validated end-to-end on Algorand localnet: a valid single-commitment proof
verifies on-chain and a tampered one is rejected; no regression on
no-commitment circuits.
utils.CompileWithPuyaPy now invokes puyapy directly (instead of
`algokit compile py`) so builds work where puyapy is provided by a Python
>=3.12 virtualenv on PATH.
8cb35b9c
pull/7/head
3/141 ++ 14 --
Merge 53744eaabc081c040149bc80128a6a2cc9e304c1 into 6ed21a12da5ba45ff8d41c3a9a88d5a7920b1cbd
6dd7fcac
pull/5/merge
4/8 ++ 0 --
Merge 1d8633f3109cb436abdac63f55b57b824c20663c into 6ed21a12da5ba45ff8d41c3a9a88d5a7920b1cbd
459caac3
pull/5/merge
4/16 ++ 8 --