-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Optimizing EIP-4844 block validation (using KZG proofs) #2915
Optimizing EIP-4844 block validation (using KZG proofs) #2915
Conversation
All code pretty much straight up copied from ethereum/EIPs#5088
Looking goods. Would it make sense to put the polynomial and KZG functions into a separate file? |
3a86b99
to
1862bc7
Compare
Pushed a commit which splits the BLS/poly/KZG code into a separate file. Let me know if you would like the organization (or the filename) to be different. I also pushed a commit that uses the native Python |
1862bc7
to
e7e5207
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @asn-d6 @adietrichs @dankrad
lgtm with my naked eyes.
if we merge it, I can test it with #2901 better.
Thanks for the review! Feel free to merge whenever! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! Looks good to me from an implementer's perspective.
```python | ||
def div(x: BLSFieldElement, y: BLSFieldElement) -> BLSFieldElement: | ||
"""Divide two field elements: `x` by `y`""" | ||
return x * inv(y) % BLS_MODULUS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Replace inv
with bls_modular_inverse
- Move more code into polynomial-commitments.md - Implement aggregated sidecar verification logic from PR ethereum#2915 - Rename `kzgs` to `kzg_commitments` Co-authored-by: Hsiao-Wei Wang <[email protected]>
Hey!
This PR introduces KZG proofs for block validation on the consensus-side, the same way that ethereum/EIPs#5088 introduces KZG proofs for mempool transaction validation on the execution-side.
The main protocol change in terms of communication is that we are now adding a KZG proof in
BlobsSidecar
. The KZG proof is just there to speed up the validation of the commitments in theBeaconBlockBody
and has no other value. Hence it doesn't actually need to go on-chain and can remain in the sidecar.Please read ethereum/EIPs#5088 for the details on how the crypto/validation logic works.
Let me know if you have any questions :)