matter-labs / bellman

Bellman zkSNARK library for community with Ethereum's BN256 support
https://matter-labs.io
Other
159 stars 79 forks source link

Wrong size in commit_fe? #39

Closed XuyangSong closed 3 years ago

XuyangSong commented 3 years ago

https://github.com/matter-labs/bellman/blob/455480a2db44ecc0423785b295981074800913e6/src/plonk/commitments/transcript/keccak_transcript.rs#L135

Should it be the element size rather than the fr size?

commit_fe is used as follows, input a fq as parameter.

https://github.com/matter-labs/bellman/blob/455480a2db44ecc0423785b295981074800913e6/src/plonk/better_cs/utils.rs#L249

It has the same size on bn curv, with result 32bytes. It will be different on bls12_381 curv.

shamatar commented 3 years ago

In theory you are right, the length of encoding will not match for BLS12-381, but it can be easily fixed in a backward compatible manner by using &mut Vec<_> instead of &mut [] to serialist an element.

But keep in mind that this transcript implementation was intentionally made Ethereum specific and there is still no support of BLS12-381 in Ethereum, so it is also ok to have a current approach