-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Update EIP-2537: Gas pricing pairing operations #9098
Conversation
✅ All reviewers have approved. |
👍 from besu, implementing these gas costs and benchmarking on a nuc 13: |
@garyschulte I updated the numbers, please recheck and approve if Besu is fine with those numbers |
EIPS/eip-2537.md
Outdated
@@ -287,7 +287,7 @@ Discounts table as a vector of pairs `[k, discount]`: | |||
|
|||
#### Pairing check operation | |||
|
|||
The cost of the pairing check operation is `43000*k + 65000` where `k` is a number of pairs. | |||
The cost of the pairing check operation is `32587*k + 37698` where `k` is a number of pairs. |
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.
Maybe let's round these to 32600 and 37700.
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.
Done, thx @chfast :)
As mentioned in #9145 2x pairing should have almost the same gas cost as the KZG_POINT_PRECOMPILE as it is doing the same thing, a pairing check with 2 pairs of (G1, G2) points. EIP-4844 was priced with BLST and gnark. I'm not sure what happened between the 1.8M gas (https://github.com/ethereum/EIPs/pull/4844/files#diff-c72ce77807acfea9e9693b7999f247841df938c9645be37013903805fa8b0c09R51) and the current 50k gas but I assume there are supporting benchmarks for both behind with hardware from 2022. cc @protolambda |
I'm guessing the KZG proof verification precompile was very aggressively down-priced by 4844 champions because this was in their interest. I can realistically treat is as good baseline for anything. For me it runs at ~50 Mgas/s while ECRECOVER 130 Mgas/s. Because the gas limit increase is planned should should pick the higher baseline. |
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.
lgtm
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.
All Reviewers Have Approved; Performing Automatic Merge...
* chore(tests): pairing ops gas pricing cf ethereum/EIPs#9098 * chore(tests): MAP, MUL & ADD gas pricing cf ethereum/EIPs#9097 * chore(tests): update G1/add G2 msm discount tables ethereum/EIPs#9116
Update: Changed numbers to Paweł's proposition, details here: https://gist.github.com/MarekM25/79982c313c1179cbfd68c9414f8925fa
ATTENTION: ERC-RELATED PULL REQUESTS NOW OCCUR IN ETHEREUM/ERCS
--
When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-template.md
We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met: