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

EIP-2537 BLS12-381 G1 add/mul/exp and G2 add/mul support with tests #2315

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

tersec
Copy link
Contributor

@tersec tersec commented Jun 7, 2024

#2302

Mostly re-enabling existing code with modified gas costs

Upstream test vectors now live at https://github.com/ethereum/EIPs/tree/master/assets/eip-2537 but there's some slight reformatting already in this repo, so keeping that

These are easier to verify the test cases for. The G2 exp cases are tricker, but they're based on the same base gas cost as G2 mul, so good to have G2 mul in place for regression/consistency checks

nimbus/evm/precompiles.nim Outdated Show resolved Hide resolved
@mratsim
Copy link
Contributor

mratsim commented Jun 7, 2024

Would it be also possible to add Mgas/s similar to what I do there: https://github.com/mratsim/constantine/blob/7ea21a2e45c5e02f8aff2cfc1d94cd3191108559/benchmarks/bench_eth_evm_precompiles.nim#L63-L76

Can be tested vs Constantine with

git clone https://github.com/mratsim/constantine
cd constantine
CC=clang nimble bench_eth_evm_precompiles

The BN254 and BLS12-381 seem significantly mispriced to me given the current state of cryptographic software.

https://ethereum-magicians.org/t/eip-2537-bls12-precompile-discussion-thread/4187/76

@tersec
Copy link
Contributor Author

tersec commented Jun 7, 2024

Would it be also possible to add Mgas/s similar to what I do there: https://github.com/mratsim/constantine/blob/7ea21a2e45c5e02f8aff2cfc1d94cd3191108559/benchmarks/bench_eth_evm_precompiles.nim#L63-L76

Can be tested vs Constantine with

git clone https://github.com/mratsim/constantine
cd constantine
CC=clang nimble bench_eth_evm_precompiles

The BN254 and BLS12-381 seem significantly mispriced to me given the current state of cryptographic software.

https://ethereum-magicians.org/t/eip-2537-bls12-precompile-discussion-thread/4187/76

It seems like various gas prices were already reduced, e.g., G1 add from 600 to 500, G2 add from 4500 to 800, and G2 mul from 55,000 to 45,000, so there's already been some consideration of this? But, alright, this seems reasonable to look at.

@jangko jangko merged commit 5008b89 into master Jun 8, 2024
25 checks passed
@jangko jangko deleted the TtE branch June 8, 2024 00:39
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

3 participants