temporary disable EIP2046 and EIP2565

This commit is contained in:
jangko 2021-01-11 14:53:51 +07:00
parent e2975b613c
commit ab314c1e04
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 10 additions and 8 deletions

View File

@ -243,7 +243,7 @@ proc execCall*(c: Computation) =
## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md
## also see: https://github.com/ethereum/EIPs/issues/716
if c.isError or c.fork == FKIstanbul:
if c.isError or c.fork >= FKIstanbul:
if c.msg.contractAddress == ripemdAddr:
# Special case to account for geth+parity bug
c.vmState.touchedAccounts.incl c.msg.contractAddress

View File

@ -777,9 +777,9 @@ template genCall(callName: untyped, opCode: Op): untyped =
# EIP 2046
# reduce gas fee for precompiles
# from 700 to 40
when opCode == StaticCall:
if c.fork >= FkBerlin and destination.toInt <= MaxPrecompilesAddr:
childGasFee = childGasFee - 660.GasInt
#when opCode == StaticCall:
# if c.fork >= FkBerlin and destination.toInt <= MaxPrecompilesAddr:
# childGasFee = childGasFee - 660.GasInt
if childGasFee >= 0:
c.gasMeter.consumeGas(childGasFee, reason = $opCode)

View File

@ -222,15 +222,17 @@ proc modExpFee(c: Computation, baseLen, expLen, modLen: Uint256, fork: Fork): Ga
max(adjExpLen, 1.u256)
) div divisor
let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
else: gasCalc(mulComplexity, GasQuadDivisor)
#let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
#else: gasCalc(mulComplexity, GasQuadDivisor)
let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
if gasFee > high(GasInt).u256:
raise newException(OutOfGas, "modExp gas overflow")
result = gasFee.truncate(GasInt)
if fork >= FkBerlin and result < 200.GasInt:
result = 200.GasInt
#if fork >= FkBerlin and result < 200.GasInt:
# result = 200.GasInt
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
## Modular exponentiation precompiled contract