OpenZeppelin / OpenZeppelin/compact-contracts
dev: add Fq, the BLS12-381 scalar field conversions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 29
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 25
Description
Compact's Field is the BLS12-381 scalar field, but nothing in the library names it, states its order, or gives the byte conversions in and out of it. Callers reach for degradeToTransient and upgradeFromTransient without a statement of what they drop (byte 31, bits 248 and up), and no circuit reduces a wider string mod q.
Add crypto/curves/bls12-381/Fq with the truncating pair under their RFC 8017 names (truncatedLEOS2IP, truncatedI2LEOSP) and fromUniformBytes, the LEOS2IP_512(tv) mod q step that hashing to the field needs, with the field's order and the ledger backends documented.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Compact's existing Field implementation and the degradeToTransient and upgradeFromTransient conversions, then inspect the crypto/curves/bls12-381 area. Add the Fq conversions and fromUniformBytes behavior described in the issue, documenting the field order, dropped bits, and ledger backends; done means the named APIs and documentation are present and wider inputs reduce modulo q.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cryptography
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100