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

Updates to BLS precompiles (EIP-2537) #1089

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

@chfast chfast added precompiles Related to EVM precompiles Prague Changes for Prague upgrade labels Dec 20, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.58%. Comparing base (50b095c) to head (64d0901).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
test/state/precompiles.cpp 0.00% 6 Missing ⚠️
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     
Flag Coverage Δ
eof_execution_spec_tests 23.64% <0.00%> (+0.01%) ⬆️
ethereum_tests 26.65% <0.00%> (+0.02%) ⬆️
ethereum_tests_silkpre 18.96% <0.00%> (+0.01%) ⬆️
execution_spec_tests ?
unittests 89.14% <25.00%> (+0.07%) ⬆️

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

Files with missing lines Coverage Δ
test/unittests/state_precompiles_test.cpp 100.00% <100.00%> (ø)
test/state/precompiles.cpp 69.92% <0.00%> (-29.01%) ⬇️

... and 4 files with indirect coverage changes

@chfast chfast requested a review from rodiazet December 20, 2024 09:24
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.
@chfast chfast force-pushed the precompiles/bls_updates branch from 9971bd0 to 6e214c6 Compare December 20, 2024 09:38
Copy link
Contributor

@rodiazet rodiazet left a 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)
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor

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,
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prague Changes for Prague upgrade precompiles Related to EVM precompiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants