-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Gas cost reduction for ECADD, ECMUL and ECPAIRING #1187
Description
Specification
If block.number >= CONSTANTINOPLE_FORK_BLKNUM, the gas cost for the following precompiles is reduced:
ECMUL: reduced from 40000 to 10000GPAIRINGBASE: reduced from 100000 to 40000GPAIRINGPERPOINT: reduced from 80000 to 40000
Motivation
Currently, operations using the alt_bn128 curve are much more expensive than secp256k1 signatures: an ECRECOVER implicitly contains 3 ECMUL operations, but ECMUL is ~13 times more expensive than ECRECOVER. There is nothing fundamentally mathematically more complex about the alt_bn128 curve that justifies this; the original numbers were calculated from implementations that existed at the time, and it just so happened that the secp256k1 implementations were much better optimized than those for alt_bn128. Recently, geth introduced a new library that allows it to do elliptic curve math faster, so a recomputation of the gas costs, to reduce the currently very high gas cost of applications using ring signatures, BLS signatures and ZK SNARKs, is worth considering.