succinctlabs / gnark-plonky2-verifier

MIT License
85 stars 25 forks source link

fix: Support range checking non aligned bitwidth values #47

Closed kevjue closed 8 months ago

kevjue commented 8 months ago

This PR modifies the poseidon chip's range checker to account for the gnark commit/logup range checker bug that doesn't correctly handle bitwidths that are not limb bit size aligned (https://github.com/Consensys/gnark/security/advisories/GHSA-rjjm-x32p-m3f7).

The changes in this PR contain the following:

1) Made the Poseidon Chip a "singleton" object per frontend.API object. 2) Modified all references of the poseidon chip to be a pointer. 3) If the commitment/logup based range checker is used, the poseidon chip will ensure that all range checked requests is divisible by 16 (which is base length / limb sizes that gnark's commit based range checker should use).