mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 13:24:21 +00:00
Reactivate the precompiles test + consume gas
This commit is contained in:
parent
29f8a8a066
commit
f50bb57eb6
@ -138,10 +138,12 @@ proc modExpInternal(computation: var BaseComputation, base_len, exp_len, mod_len
|
|||||||
max(adj_exp_len, 1)
|
max(adj_exp_len, 1)
|
||||||
) div GasQuadDivisor
|
) div GasQuadDivisor
|
||||||
|
|
||||||
|
computation.gasMeter.consumeGas(gasFee, reason="ModExp Precompile")
|
||||||
|
|
||||||
block: # Processing
|
block: # Processing
|
||||||
# TODO: specs mentions that we should return in "M" format
|
# TODO: specs mentions that we should return in "M" format
|
||||||
# i.e. if Base and exp are uint512 and Modulo an uint256
|
# i.e. if Base and exp are uint512 and Modulo an uint256
|
||||||
# we should return a 256-bit big-endian byte array
|
# we should return a 256-bit big-endian byte array
|
||||||
|
|
||||||
# Force static evaluation
|
# Force static evaluation
|
||||||
func zero(): static array[T.bits div 8, byte] = discard
|
func zero(): static array[T.bits div 8, byte] = discard
|
||||||
|
@ -39,18 +39,17 @@ template doTest(fixture: JsonNode, address: byte, action: untyped): untyped =
|
|||||||
proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
||||||
for label, child in fixtures:
|
for label, child in fixtures:
|
||||||
case toLowerAscii(label)
|
case toLowerAscii(label)
|
||||||
# of "ecrecover": child.doTest(paEcRecover.ord, ecRecover)
|
of "ecrecover": child.doTest(paEcRecover.ord, ecRecover)
|
||||||
# of "sha256": child.doTest(paSha256.ord, sha256)
|
of "sha256": child.doTest(paSha256.ord, sha256)
|
||||||
# of "ripemd": child.doTest(paRipeMd160.ord, ripemd160)
|
of "ripemd": child.doTest(paRipeMd160.ord, ripemd160)
|
||||||
# of "identity": child.doTest(paIdentity.ord, identity)
|
of "identity": child.doTest(paIdentity.ord, identity)
|
||||||
of "modexp": child.doTest(paModExp.ord, modexp)
|
of "modexp": child.doTest(paModExp.ord, modexp)
|
||||||
# of "bn256add": child.doTest(paEcAdd.ord, bn256ECAdd)
|
of "bn256add": child.doTest(paEcAdd.ord, bn256ECAdd)
|
||||||
# of "bn256mul": child.doTest(paEcMul.ord, bn256ECMul)
|
of "bn256mul": child.doTest(paEcMul.ord, bn256ECMul)
|
||||||
# of "ecpairing": child.doTest(paPairing.ord, bn256ecPairing)
|
of "ecpairing": child.doTest(paPairing.ord, bn256ecPairing)
|
||||||
else:
|
else:
|
||||||
#raise newException(ValueError, "Unknown test vector '" & $label & "'")
|
#raise newException(ValueError, "Unknown test vector '" & $label & "'")
|
||||||
# echo "Unknown test vector '" & $label & "'"
|
echo "Unknown test vector '" & $label & "'"
|
||||||
discard
|
|
||||||
|
|
||||||
suite "Precompiles":
|
suite "Precompiles":
|
||||||
jsonTest("PrecompileTests", testFixture)
|
jsonTest("PrecompileTests", testFixture)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user