diff options
author | Antonio Salazar Cardozo <savedfastcool@gmail.com> | 2019-08-06 22:12:54 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-08-06 22:12:54 +0800 |
commit | beff5fa578b5349004d146d6e399aa0cca1550e5 (patch) | |
tree | 3939efda97bffbac4dc08f58dcdf27b2735878bb /params/protocol_params.go | |
parent | aa6005b469fdd1aa7a95f501ce87908011f43159 (diff) | |
download | go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar.gz go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar.bz2 go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar.lz go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar.xz go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.tar.zst go-tangerine-beff5fa578b5349004d146d6e399aa0cca1550e5.zip |
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
Diffstat (limited to 'params/protocol_params.go')
-rw-r--r-- | params/protocol_params.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/params/protocol_params.go b/params/protocol_params.go index 01dc197af..110fc16ec 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -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 ( |