diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 9887bef8d..17b1901ea 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -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 diff --git a/nimbus/vm2/precompiles.nim b/nimbus/vm2/precompiles.nim index f3c007870..e0ed221dd 100644 --- a/nimbus/vm2/precompiles.nim +++ b/nimbus/vm2/precompiles.nim @@ -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 diff --git a/tests/test_allowed_to_fail.nim b/tests/test_allowed_to_fail.nim index b9d1efe4b..3286ec3c5 100644 --- a/tests/test_allowed_to_fail.nim +++ b/tests/test_allowed_to_fail.nim @@ -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