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

Implement EIP-2537 #956

Merged
merged 18 commits into from
Aug 31, 2024
Merged

Implement EIP-2537 #956

merged 18 commits into from
Aug 31, 2024

Conversation

gurukamath
Copy link
Collaborator

(closes #936 )

What was wrong?

EIP-2537 needs is not currently implemented

Related to Issue #936

How was it fixed?

Implemented the EIP

Cute Animal Picture

Cute Animals - 1 of 1

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 97.49104% with 7 lines in your changes are missing coverage. Please review.

Please upload report for BASE (forks/prague@99a7765). Learn more about missing BASE report.

Files Patch % Lines
src/ethereum/prague/blocks.py 89.13% 5 Missing ⚠️
src/ethereum/prague/fork.py 95.45% 1 Missing ⚠️
...vm/precompiled_contracts/bls12_381/bls12_381_g2.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##             forks/prague     #956   +/-   ##
===============================================
  Coverage                ?   74.96%           
===============================================
  Files                   ?      688           
  Lines                   ?    38174           
  Branches                ?        0           
===============================================
  Hits                    ?    28619           
  Misses                  ?     9555           
  Partials                ?        0           
Flag Coverage Δ
unittests 74.96% <97.49%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@petertdavies petertdavies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the src/ethereum/prague/vm/precompiled_contracts/bls12_381/ and found a couple of issues, but the code generally looks good.

I'll do a further review when you rebase.

gurukamath and others added 11 commits August 15, 2024 16:21
The current spec implementaion of the point evatuation pre-compile inttoduced in cancun makes use of eth2spec (consensus-specs). This leads to potential dependency conflicts like when execution-specs wants to use a different version of py_ecc than the consensus-specs. This commit removes the need to depend on eth2spec and implements the necessary components of KZG
@gurukamath
Copy link
Collaborator Author

Re-based on the latest forks/prague

Copy link
Collaborator

@SamWilsn SamWilsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment, but docstrings should be written in markdown now. Don't worry about fixing this PR, but going forward it'll make my life a bit easier.

G1_POINT_AT_INFINITY = b"\xc0" + b"\x00" * 47
BLS_MODULUS = 52435875175126190479447740508185965837690552500527637822603658699938581184513 # noqa: E501
KZG_SETUP_G2_LENGTH = 65
KZG_SETUP_G2_MONOMIAL_1 = "0xb5bfd7dd8cdeb128843bc287230af38926187075cbfbefa81009a2ce615ac53d2914e5870cb452d2afaaab24f3499f72185cbfee53492714734429b7b38608e23926c911cceceac9a36851477ba4c60b087041de621000edc98edada20c1def2" # noqa: E501
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a hex string, while BLS_MODULUS is an integer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLS_MODULUS is an integer.

KZG_SETUP_G2_MONOMIAL_1 is an G2 elliptic curve point encoded in a standard binary format.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my point is that KZG_SETUP_G2_MONOMIAL_1 is conceptually not a string. It should probably be Bytes?

src/ethereum/crypto/kzg.py Show resolved Hide resolved
Verify KZG proof that ``p(z) == y`` where ``p(z)``
is the polynomial represented by ``polynomial_kzg``.
Receives inputs as bytes.
Public method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visibility is normally indicated by the presence or absence of a leading underscore, where no underscore is "public."

src/ethereum_spec_tools/evm_tools/t8n/__init__.py Outdated Show resolved Hide resolved
src/ethereum_spec_tools/evm_tools/t8n/env.py Outdated Show resolved Hide resolved
tests/prague/test_state_transition.py Show resolved Hide resolved
@gurukamath gurukamath merged commit a6f5eae into forks/prague Aug 31, 2024
5 checks passed
@gurukamath gurukamath mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants