-
Notifications
You must be signed in to change notification settings - Fork 298
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
Updates to BLS precompiles (EIP-2537) #1089
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1089 +/- ##
==========================================
- Coverage 94.31% 93.58% -0.73%
==========================================
Files 159 159
Lines 17221 17207 -14
==========================================
- Hits 16242 16104 -138
- Misses 979 1103 +124
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This updates the gas costs of BLS precompiles. Discounts tables for MSMs are not split between G1 and G2 variants. We additionally pre-process the tables to more directly consumable form.
Remove redundant G1/G2 MUL precompiles easily replaceable with MSMs. Spec update: ethereum/EIPs#8945.
9971bd0
to
6e214c6
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.
It's OK in general. A few nits to be fixed.
524, 523, 522, 522, 521, 520, 520, 519}; | ||
static constexpr auto POINT_COSTS = | ||
bls12_msm_discounts_to_point_costs(G1MUL_GAS_COST, DISCOUNTS); | ||
|
||
if (input.empty() || input.size() % 160 != 0) |
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.
Can we define single input size and use ut here and below? Same for G2
@@ -176,7 +158,7 @@ PrecompileAnalysis point_evaluation_analyze(bytes_view, evmc_revision) noexcept | |||
|
|||
PrecompileAnalysis bls12_g1add_analyze(bytes_view, evmc_revision) noexcept | |||
{ | |||
static constexpr auto BLS12_G1ADD_PRECOMPILE_GAS = 500; | |||
static constexpr auto BLS12_G1ADD_PRECOMPILE_GAS = 375; |
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.
If we are not going to squash the commits before merging this change should go to different commit.
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.
Same applies to g2add, g2mul, pairing, g2 map analysis
@@ -443,20 +443,6 @@ ExecutionResult bls12_g1add_execute(const uint8_t* input, size_t input_size, uin | |||
return {EVMC_SUCCESS, 128}; | |||
} | |||
|
|||
ExecutionResult bls12_g1mul_execute(const uint8_t* input, size_t input_size, uint8_t* output, |
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.
Remove also their analysis
counterparts for g1 and g2. Here and from the header.
Apply recent EIP-2537 spec updates: