Gas cost of ECPAIRING is incorrect
livnev opened this issue · 1 comments
livnev commented
The yellow paper specifies the gas cost of ECPAIRING
as 60,000k + 40,000, where k
is the number of pairs of curve points to check. In reality, it should be 80,000k + 100,000. This is confirmed by cross-referencing with the following implementations:
rule <k> #gasExec(_, ECPAIRING) => 100000 +Int (#sizeWordStack(DATA) /Int 192) *Int 80000 ... </k> <callData> DATA </callData>
GAS_ECPAIRING_BASE = 100000
GAS_ECPAIRING_PER_POINT = 80000
ETH_REGISTER_PRECOMPILED_PRICER(alt_bn128_pairing_product)(bytesConstRef _in)
{
return 100000 + (_in.size() / 192) * 80000;
}
"0x0000000000000000000000000000000000000008": {
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": "0x42ae50",
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
"pair": 80000
}
}
}
},
nicksavers commented
Good catch