reenable EIP-2565: modExp gas cost
now it's officially included in berlin hard fork
This commit is contained in:
parent
01a27ff328
commit
6fc3df637c
|
@ -229,20 +229,20 @@ proc modExpFee(c: Computation, baseLen, expLen, modLen: Uint256, fork: Fork): Ga
|
|||
max(adjExpLen, 1.u256)
|
||||
) div divisor
|
||||
|
||||
# EIP2565: temporary disabled
|
||||
#let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||
#else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||
# EIP2565: modExp gas cost
|
||||
let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||
else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||
|
||||
let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||
#let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||
|
||||
if gasFee > high(GasInt).u256:
|
||||
raise newException(OutOfGas, "modExp gas overflow")
|
||||
|
||||
result = gasFee.truncate(GasInt)
|
||||
|
||||
# EIP2565: temporary disabled
|
||||
#if fork >= FkBerlin and result < 200.GasInt:
|
||||
# result = 200.GasInt
|
||||
# EIP2565: modExp gas cost
|
||||
if fork >= FkBerlin and result < 200.GasInt:
|
||||
result = 200.GasInt
|
||||
|
||||
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
||||
## Modular exponentiation precompiled contract
|
||||
|
|
|
@ -239,20 +239,20 @@ proc modExpFee(c: Computation, baseLen, expLen, modLen: Uint256, fork: Fork): Ga
|
|||
max(adjExpLen, 1.u256)
|
||||
) div divisor
|
||||
|
||||
# EIP2565: temporary disabled
|
||||
#let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||
#else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||
# EIP2565: modExp gas cost
|
||||
let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||
else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||
|
||||
let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||
# let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||
|
||||
if gasFee > high(GasInt).u256:
|
||||
raise newException(OutOfGas, "modExp gas overflow")
|
||||
|
||||
result = gasFee.truncate(GasInt)
|
||||
|
||||
# EIP2565: temporary disabled
|
||||
#if fork >= FkBerlin and result < 200.GasInt:
|
||||
# result = 200.GasInt
|
||||
# EIP2565: modExp gas cost
|
||||
if fork >= FkBerlin and result < 200.GasInt:
|
||||
result = 200.GasInt
|
||||
|
||||
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
||||
## Modular exponentiation precompiled contract
|
||||
|
|
|
@ -129,5 +129,7 @@ func skipNewBCTests*(folder: string, name: string): bool =
|
|||
]
|
||||
|
||||
func skipPrecompilesTests*(folder: string, name: string): bool =
|
||||
# EIP2565: temporary disabled
|
||||
name == "modexp_eip2565.json"
|
||||
# EIP2565: modExp gas cost
|
||||
# reason: included in berlin
|
||||
# name == "modexp_eip2565.json"
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue