params, core/vm: Istanbul EIP-1108 bn256 gas cost reduction (#19904)
* params: add IsIstanbul to config + rules IstanbulBlock, used to determine if the config IsIstanbul, is currently left nil until an actual block is chosen. * params, core/vm: implement EIP-1108 Old gas costs for elliptic curve operations are given the PreIstanbul prefix, while current gas costs retain the unprefixed names. The actual precompile implementations are the same, so they are factored out into common functions that are called by the pre-Istanbul and current precompile structs. Finally, an Istanbul precompile list is added that references the new precompile structs, which in turn reference the new gas costs. * params: fix fork ordering, add missing chain compatibility check
This commit is contained in:
committed by
Péter Szilágyi
parent
aa6005b469
commit
beff5fa578
@ -99,18 +99,23 @@ const (
|
||||
|
||||
// Precompiled contract gas prices
|
||||
|
||||
EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price
|
||||
Sha256BaseGas uint64 = 60 // Base price for a SHA256 operation
|
||||
Sha256PerWordGas uint64 = 12 // Per-word price for a SHA256 operation
|
||||
Ripemd160BaseGas uint64 = 600 // Base price for a RIPEMD160 operation
|
||||
Ripemd160PerWordGas uint64 = 120 // Per-word price for a RIPEMD160 operation
|
||||
IdentityBaseGas uint64 = 15 // Base price for a data copy operation
|
||||
IdentityPerWordGas uint64 = 3 // Per-work price for a data copy operation
|
||||
ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation
|
||||
Bn256AddGas uint64 = 500 // Gas needed for an elliptic curve addition
|
||||
Bn256ScalarMulGas uint64 = 40000 // Gas needed for an elliptic curve scalar multiplication
|
||||
Bn256PairingBaseGas uint64 = 100000 // Base price for an elliptic curve pairing check
|
||||
Bn256PairingPerPointGas uint64 = 80000 // Per-point price for an elliptic curve pairing check
|
||||
EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price
|
||||
Sha256BaseGas uint64 = 60 // Base price for a SHA256 operation
|
||||
Sha256PerWordGas uint64 = 12 // Per-word price for a SHA256 operation
|
||||
Ripemd160BaseGas uint64 = 600 // Base price for a RIPEMD160 operation
|
||||
Ripemd160PerWordGas uint64 = 120 // Per-word price for a RIPEMD160 operation
|
||||
IdentityBaseGas uint64 = 15 // Base price for a data copy operation
|
||||
IdentityPerWordGas uint64 = 3 // Per-work price for a data copy operation
|
||||
ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation
|
||||
|
||||
Bn256AddGasByzantium uint64 = 500 // Byzantium gas needed for an elliptic curve addition
|
||||
Bn256AddGasIstanbul uint64 = 150 // Gas needed for an elliptic curve addition
|
||||
Bn256ScalarMulGasByzantium uint64 = 40000 // Byzantium gas needed for an elliptic curve scalar multiplication
|
||||
Bn256ScalarMulGasIstanbul uint64 = 6000 // Gas needed for an elliptic curve scalar multiplication
|
||||
Bn256PairingBaseGasByzantium uint64 = 100000 // Byzantium base price for an elliptic curve pairing check
|
||||
Bn256PairingBaseGasIstanbul uint64 = 45000 // Base price for an elliptic curve pairing check
|
||||
Bn256PairingPerPointGasByzantium uint64 = 80000 // Byzantium per-point price for an elliptic curve pairing check
|
||||
Bn256PairingPerPointGasIstanbul uint64 = 34000 // Per-point price for an elliptic curve pairing check
|
||||
)
|
||||
|
||||
var (
|
||||
|
Reference in New Issue
Block a user