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

chore: Add invariant test for G1/G2 Scalar multiplication #2247

Merged

Conversation

kevaundray
Copy link
Contributor

The G1/G2 scalar multiplication gas costs are specified in two different places in the EIP in two different ways.

They are equal when the first value in the discount table is equal to the MSM_MULTIPLIER. It is not the most robust way to check this invariant because you can compute the cost for G1/2_MUL in a more convoluted way.

If a more convoluted way is chosen, then this test should start to fail.

What this means is that if we wanted to just change the cost for G1/2_MUL we would need to change the MSM_BASE_GAS_FEE. It was done this way because there is some relationship between the cost for a scalar multiplication and the cost to do an MSM which is multiple scalar multiplications.

Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Performance Report

Merging #2247 will not alter performance

Comparing kevaundray:kw/add-invariant-test-for-constant (fb9432f) with main (e99a186)

Summary

✅ 8 untouched benchmarks

@kevaundray
Copy link
Contributor Author

Blocking as I am not sure that the EIP-2537 tests are running

@kevaundray kevaundray marked this pull request as ready for review March 18, 2025 21:11
@rakita
Copy link
Member

rakita commented Mar 19, 2025

This is a unit test and it does not touch the eth state tests, it is safe to merge imo. We had problem with CI eof-verification that is fixed on the main

@rakita rakita merged commit 2bec8c1 into bluealloy:main Mar 19, 2025
25 of 29 checks passed
This was referenced Mar 19, 2025
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.

None yet

2 participants