-
Notifications
You must be signed in to change notification settings - Fork 563
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
BEP-225: Implement EIP-2565 ModExp Gas Cost #225
Conversation
BEP: 225 Title: Implement EIP2565 ModExp Gas Cost Status: Draft Type: Standards Created: 2023-4-27 BEP-225: Implement EIP-2565 ModExp Gas Cost1. SummaryAs part of Berlin upgrade, EIP-2565: ModExp Gas Cost is required to be implemented to BSC. This EIP Defines the gas cost of the 2. AbstractTo accurately reflect the real world operational cost of the This algorithm approximates the multiplication complexity cost and multiplies that by an approximation of the 3. MotivationRefer to EIP-2565 description: Modular exponentiation is a foundational arithmetic operation for many cryptographic functions including signatures, By reducing the cost of this precompile, these cryptographic functions become more practical, enabling improved 4. SpecificationAs of
5. RationaleAfter benchmarking the ModExp precompile, we discovered that it is ‘overpriced’ relative to other precompiles. We also discovered that the current gas pricing formula could be improved to better estimate the computational complexity of various ModExp input variables. The following changes improve the accuracy of the ModExp pricing: Modify
|
Test Case | EIP-198 Pricing | EIP-2565 Pricing |
---|---|---|
modexp_nagydani_1_square | 204 | 200 |
modexp_nagydani_1_qube | 204 | 200 |
modexp_nagydani_1_pow0x10001 | 3276 | 341 |
modexp_nagydani_2_square | 665 | 200 |
modexp_nagydani_2_qube | 665 | 200 |
modexp_nagydani_2_pow0x10001 | 10649 | 1365 |
modexp_nagydani_3_square | 1894 | 341 |
modexp_nagydani_3_qube | 1894 | 341 |
modexp_nagydani_3_pow0x10001 | 30310 | 5461 |
modexp_nagydani_4_square | 5580 | 1365 |
modexp_nagydani_4_qube | 5580 | 1365 |
modexp_nagydani_4_pow0x10001 | 89292 | 21845 |
modexp_nagydani_5_square | 17868 | 5461 |
modexp_nagydani_5_qube | 17868 | 5461 |
modexp_nagydani_5_pow0x10001 | 285900 | 87381 |
7. Security Considerations
The biggest security consideration for this EIP is creating a potential DoS vector by making ModExp operations too inexpensive relative to their computation time.
8. License
The content is licensed under CC0.
9. Reference
Most description of this BEP refer to EIP-2565:
Kelly Olson (@ineffectualproperty), Sean Gulley (@sean-sn), Simon Peffers (@simonatsn), Justin Drake (@JustinDrake), Dankrad Feist (@dankrad), "EIP-2565: ModExp Gas Cost," Ethereum Improvement Proposals, no. 2565, March 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2565.
No description provided.