Skip to content

Gas cost reduction for ECADD, ECMUL and ECPAIRING #1187

@vbuterin

Description

@vbuterin

Specification

If block.number >= CONSTANTINOPLE_FORK_BLKNUM, the gas cost for the following precompiles is reduced:

  • ECMUL: reduced from 40000 to 10000
  • GPAIRINGBASE: reduced from 100000 to 40000
  • GPAIRINGPERPOINT: 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions