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

feat: stabilize alt_bn128 familiy of host functions #6813

Closed
wants to merge 4 commits into from

Conversation

matklad
Copy link
Contributor

@matklad matklad commented May 16, 2022

Feature to stabilize

This PR stabilizes three host functions: alt_bn128_g1_multiexp, alt_bn128_g1_sum, alt_bn128_pairing_check. They implement addition, scalar multiplication, and pairing check for a specific elliptic curve used in the ethereum ecosystem (eip-196).

Testing and QA

This feature underwent extensive testing:

  • we had several audits
  • aurora impements ethereum precompiles on top of these host functions, and those precompiles pass ethereum tests
  • this PR adds a couple more tests generating using the implementation used in go-ethereum.
  • we verified our costs against costs in ethereum, they are roughly comparable in terms of wall-clock time

Pre-mortem

The biggest risk I see is that we are not experts in elliptic curve crypto, so it's hard to judge if the API overall makes sense. Maybe it could be more general, maybe there are better curves, etc. However, it does fit aurora use-case and, given that the impl here is rather straightforward, even if we change something in the future, keeping the current functions won't be too onerous.

Checklist

  • Link to nightly nayduck run (./scripts/nayduck.py, docs): https://nayduck.near.org/
  • Update CHANGELOG.md to include this protocol feature in the Unreleased section.

@matklad matklad changed the title M/stabilize altbn 128 feat: stabilize alt_bn128 familiy of host functions May 16, 2022
@matklad matklad force-pushed the m/stabilize-altbn-128 branch 8 times, most recently from 121873f to 03377ea Compare May 18, 2022 11:16
Extra test cases were generated using go-ethereum implementation of the
curves.
@matklad matklad force-pushed the m/stabilize-altbn-128 branch from 03377ea to 147d3bd Compare May 18, 2022 11:31
@matklad matklad force-pushed the m/stabilize-altbn-128 branch from 147d3bd to d9926fe Compare May 18, 2022 11:44
@matklad matklad marked this pull request as ready for review May 18, 2022 12:05
@matklad matklad requested a review from a team as a code owner May 18, 2022 12:05
@matklad matklad requested a review from nikurt May 18, 2022 12:05
@matklad matklad closed this May 18, 2022
@matklad matklad deleted the m/stabilize-altbn-128 branch May 18, 2022 12:07
@matklad
Copy link
Contributor Author

matklad commented May 18, 2022

(opened Pr from a wrong fork, re-submitted as #6824)

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.

1 participant