-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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-1108: Reduce alt bn128 gas costs #1108
Merged
Arachnid
merged 9 commits into
ethereum:master
from
keep-network:eip-reduce-alt_bn128-gas-costs
Jun 4, 2018
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dd9f6be
Add draft of elliptic-curve gas cost reduction EIP
Shadowfiend 21e3f06
Add status and EIP dependencies
Shadowfiend d1aafab
Lowercase preamble per observed practice
Shadowfiend d8eaa3e
Tweak EIP title to reflect core cause for cost reduction
Shadowfiend 1311b36
Reduce constant factor in line with original EIP issue
Shadowfiend 9fd2cd1
Fix footnote formatting
Shadowfiend 4ef1d40
Drop extraneous code fence
Shadowfiend 1a97a7b
GitHub username only for EIP author line
Shadowfiend 40e45ab
Label alt_bn128 gas cost EIP as EIP 1108
Shadowfiend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
``` | ||
eip: <to be assigned> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename to eip-1108.md and number 1108. |
||
title: Reduce alt_bn128 precompile gas costs | ||
author: Antonio Salazar Cardozo (@shadowfiend) <[email protected]> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please supply either github username or email, not both. |
||
status: Draft | ||
type: Standards Track | ||
category: Core | ||
created: 2018-05-21 | ||
requires: 196, 197 | ||
``` | ||
--- | ||
|
||
## Short Description | ||
|
||
Recent changes to the underlying library used by the official Go reference | ||
implementation led to significant performance gains for the `ECADD`, `ECMUL`, | ||
and pairing check precompiled contracts on the `alt_bn128` elliptic curve, which | ||
should be reflected in reduced gas costs. | ||
|
||
## Motivation | ||
|
||
Recently, the underlying library used by the [official Go reference | ||
implementation](https://github.com/ethereum/go-ethereum) to implement the | ||
`ECADD` (at address `0x06`), `ECMUL` (at address `0x07`), and pairing check (at | ||
address `0x08`) precompiled contracts was shifted to [Cloudflare's bn256 | ||
library](https://github.com/cloudflare/bn256). Based on the [initial PR that | ||
introduced this change](https://github.com/ethereum/go-ethereum/pull/16203), | ||
and corroborated in [a later | ||
note](https://github.com/ethereum/go-ethereum/pull/16301#issuecomment-372687543), | ||
the computational cost of `ECADD`, `ECMUL`, and pairing checks (excepting the | ||
constant) has dropped roughly an order of magnitude across the board. | ||
|
||
## Specification | ||
|
||
Following is a table with the current gas cost and new gas cost: | ||
|
||
| Contract | Address | Current Gas Cost | Updated Gas Cost | | ||
| ------------- | --------- | ----------------------------- | ------------------- | | ||
| `ECADD` | `0x06` | 500<sup>[1]</sup> | 50 | | ||
| `ECMUL` | `0x07` | 40 000<sup>[1]</sup> | 2 000 | | ||
| Pairing check | `0x08` | 80 000k + 100 000<sup>[2]</sup>| 5 500k + 80 000 | | ||
|
||
The gas costs for `ECADD` and `ECMUL` are updates to the costs listed in | ||
EIP-196, while the gas costs for the pairing check are updates to the cost | ||
listed in EIP-197. | ||
|
||
[1]- Per [EIP-196](https://github.com/ethereum/EIPs/blob/984cf5de90bbf5fbe7e49be227b0c2f9567e661e/EIPS/eip-196.md#gas-costs). | ||
|
||
[2]- Per [EIP-197](https://github.com/ethereum/EIPs/blob/df132cd37efb3986f9cd3ef4922b15a767d2c54a/EIPS/eip-197.md#specification). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please remove the backticks here to comply with the standard formatting.