protolambda / go-kzg

FFT, data-recovery and KZG commitments, a.k.a. Kate commitments, in Go - *super experimental*
MIT License
90 stars 26 forks source link

Why are there 4096 secret g2 points in the trusted setup? #38

Closed jtraglia closed 1 year ago

jtraglia commented 1 year ago

Is there a reason there are so many secret g2 points in the embedded trusted setup? There are 4096 (which matches the number of secret g1 points) but I believe only 65 are required. This is what C-KZG-4844 uses in their trusted setup. The secret g1 points & the first 65 secret g2 points do match C-KZG-4844. The number of points seems intentional, as there's this check:

https://github.com/protolambda/go-kzg/blob/c91cee5e954e1506cc940d404a7918e17b258749/kzg.go#L22-L24

protolambda commented 1 year ago

The KZGSettings code is about a year older than the first shared testing-only KZG trusted setup, and there was no reason to reduce it to less G2 points at the time.

jtraglia commented 1 year ago

Ah okay, pretty much what I expected. Would you like for me to make a PR to remove the excess ones?

protolambda commented 1 year ago

I think reducing it affects CheckProofMulti; multi-proofs must then be smaller. @asn-d6 where can I find the reasoning for the smaller KZG G2? Doesn't this affect data-availability sampling?

asn-d6 commented 1 year ago

Hey proto. Check out https://github.com/ethereum/consensus-specs/pull/3156 .