Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for canonical Fp elements in MSM #1445

Conversation

Rjected
Copy link
Collaborator

@Rjected Rjected commented May 20, 2024

This checks that the scalar values being used in precompiles are canonical, as in, they are valid Fr elements. A similar check is performed in c-kzg-4844 here: https://github.com/ethereum/c-kzg-4844/blob/5b35b6147bf269b16c1bffd268fd03bac0c00b64/src/c_kzg_4844.c#L544

This could have been particularly bad, as geth (and other implementations) would have rejected certain scalar values that we would not have. EDIT: see below

@Rjected Rjected added bug Something isn't working hf-prague Prague related EIPs labels May 20, 2024
@Rjected
Copy link
Collaborator Author

Rjected commented May 20, 2024

This is not a bug, geth does not actually check that scalars used are canonical Fr elements because it uses SetBytes:
https://github.com/Consensys/gnark-crypto/blob/564b6f724c3beac52d805e6e600d0a1fda9770b5/ecc/bls12-381/fr/element.go#L910-L934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hf-prague Prague related EIPs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant