EspressoSystems / espresso-sequencer

96 stars 68 forks source link

I12: Deviation from positive or negative G1 point encoding conventions #1748

Open philippecamacho opened 2 months ago

philippecamacho commented 2 months ago

Affected Code: BN254.sol (line 286)

Summary: The encoding of G1 points assigns higher values to encode of positive Y coordinates and lower values to encode negative Y coordinates, which is not a conventional practice.

Suggestion: We suggest the following two options: • Update the documentation to include both clear definition of what ”positive” means in the context of G1 point encoding and clarification that the current design choices were made to ensure compatibility with Arkworks. • Alternatively, update the code to match the conventional practice of encoding positive points as small and negative points as big.

alxiong commented 2 months ago

I'm fine with either option, is there a gas difference (don't think so?)?

May I ask where does the "conventional practice" here come from? Some established libraries? Would love to learn more.

philippecamacho commented 1 month ago

The new plonk verifier (PlonkVerifier2.sol) is no longer using any related function. So we will address this issue later.