mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
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)
|
max(adjExpLen, 1.u256)
|
||||||
) div divisor
|
) div divisor
|
||||||
|
|
||||||
# EIP2565: temporary disabled
|
# EIP2565: modExp gas cost
|
||||||
#let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||||
#else: gasCalc(mulComplexity, GasQuadDivisor)
|
else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||||
|
|
||||||
let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
#let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||||
|
|
||||||
if gasFee > high(GasInt).u256:
|
if gasFee > high(GasInt).u256:
|
||||||
raise newException(OutOfGas, "modExp gas overflow")
|
raise newException(OutOfGas, "modExp gas overflow")
|
||||||
|
|
||||||
result = gasFee.truncate(GasInt)
|
result = gasFee.truncate(GasInt)
|
||||||
|
|
||||||
# EIP2565: temporary disabled
|
# EIP2565: modExp gas cost
|
||||||
#if fork >= FkBerlin and result < 200.GasInt:
|
if fork >= FkBerlin and result < 200.GasInt:
|
||||||
# result = 200.GasInt
|
result = 200.GasInt
|
||||||
|
|
||||||
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
||||||
## Modular exponentiation precompiled contract
|
## Modular exponentiation precompiled contract
|
||||||
|
@ -239,20 +239,20 @@ proc modExpFee(c: Computation, baseLen, expLen, modLen: Uint256, fork: Fork): Ga
|
|||||||
max(adjExpLen, 1.u256)
|
max(adjExpLen, 1.u256)
|
||||||
) div divisor
|
) div divisor
|
||||||
|
|
||||||
# EIP2565: temporary disabled
|
# EIP2565: modExp gas cost
|
||||||
#let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
let gasFee = if fork >= FkBerlin: gasCalc(mulComplexityEIP2565, GasQuadDivisorEIP2565)
|
||||||
#else: gasCalc(mulComplexity, GasQuadDivisor)
|
else: gasCalc(mulComplexity, GasQuadDivisor)
|
||||||
|
|
||||||
let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
# let gasFee = gasCalc(mulComplexity, GasQuadDivisor)
|
||||||
|
|
||||||
if gasFee > high(GasInt).u256:
|
if gasFee > high(GasInt).u256:
|
||||||
raise newException(OutOfGas, "modExp gas overflow")
|
raise newException(OutOfGas, "modExp gas overflow")
|
||||||
|
|
||||||
result = gasFee.truncate(GasInt)
|
result = gasFee.truncate(GasInt)
|
||||||
|
|
||||||
# EIP2565: temporary disabled
|
# EIP2565: modExp gas cost
|
||||||
#if fork >= FkBerlin and result < 200.GasInt:
|
if fork >= FkBerlin and result < 200.GasInt:
|
||||||
# result = 200.GasInt
|
result = 200.GasInt
|
||||||
|
|
||||||
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
proc modExp*(c: Computation, fork: Fork = FkByzantium) =
|
||||||
## Modular exponentiation precompiled contract
|
## Modular exponentiation precompiled contract
|
||||||
|
@ -129,5 +129,7 @@ func skipNewBCTests*(folder: string, name: string): bool =
|
|||||||
]
|
]
|
||||||
|
|
||||||
func skipPrecompilesTests*(folder: string, name: string): bool =
|
func skipPrecompilesTests*(folder: string, name: string): bool =
|
||||||
# EIP2565: temporary disabled
|
# EIP2565: modExp gas cost
|
||||||
name == "modexp_eip2565.json"
|
# reason: included in berlin
|
||||||
|
# name == "modexp_eip2565.json"
|
||||||
|
return false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user