diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 17b1901ea..d584cd66b 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -19,15 +19,17 @@ type # Istanbul paBlake2bf # Berlin - paBlsG1Add - paBlsG1Mul - paBlsG1MultiExp - paBlsG2Add - paBlsG2Mul - paBlsG2MultiExp - paBlsPairing - paBlsMapG1 - paBlsMapG2 + # EIP 2537: disabled + # reason: not included in berlin + # paBlsG1Add + # paBlsG1Mul + # paBlsG1MultiExp + # paBlsG2Add + # paBlsG2Mul + # paBlsG2MultiExp + # paBlsPairing + # paBlsMapG1 + # paBlsMapG2 iterator activePrecompiles*(): EthAddress = var res: EthAddress @@ -667,7 +669,9 @@ proc blsMapG2*(c: Computation) = proc getMaxPrecompileAddr(fork: Fork): PrecompileAddresses = if fork < FkByzantium: paIdentity elif fork < FkIstanbul: paPairing - elif fork < FkBerlin: paBlake2bf + # EIP 2537: disabled + # reason: not included in berlin + # elif fork < FkBerlin: paBlake2bf else: PrecompileAddresses.high proc execPrecompiles*(computation: Computation, fork: Fork): bool {.inline.} = @@ -691,15 +695,17 @@ proc execPrecompiles*(computation: Computation, fork: Fork): bool {.inline.} = of paEcMul: bn256ecMul(computation, fork) of paPairing: bn256ecPairing(computation, fork) of paBlake2bf: blake2bf(computation) - of paBlsG1Add: blsG1Add(computation) - of paBlsG1Mul: blsG1Mul(computation) - of paBlsG1MultiExp: blsG1MultiExp(computation) - of paBlsG2Add: blsG2Add(computation) - of paBlsG2Mul: blsG2Mul(computation) - of paBlsG2MultiExp: blsG2MultiExp(computation) - of paBlsPairing: blsPairing(computation) - of paBlsMapG1: blsMapG1(computation) - of paBlsMapG2: blsMapG2(computation) + # EIP 2537: disabled + # reason: not included in berlin + # of paBlsG1Add: blsG1Add(computation) + # of paBlsG1Mul: blsG1Mul(computation) + # of paBlsG1MultiExp: blsG1MultiExp(computation) + # of paBlsG2Add: blsG2Add(computation) + # of paBlsG2Mul: blsG2Mul(computation) + # of paBlsG2MultiExp: blsG2MultiExp(computation) + # of paBlsPairing: blsPairing(computation) + # of paBlsMapG1: blsMapG1(computation) + # of paBlsMapG2: blsMapG2(computation) except OutOfGas as e: # cannot use setError here, cyclic dependency computation.error = Error(info: e.msg, burnsGas: true) diff --git a/nimbus/vm2/precompiles.nim b/nimbus/vm2/precompiles.nim index e0ed221dd..f673bd632 100644 --- a/nimbus/vm2/precompiles.nim +++ b/nimbus/vm2/precompiles.nim @@ -29,15 +29,17 @@ type # Istanbul paBlake2bf # Berlin - paBlsG1Add - paBlsG1Mul - paBlsG1MultiExp - paBlsG2Add - paBlsG2Mul - paBlsG2MultiExp - paBlsPairing - paBlsMapG1 - paBlsMapG2 + # EIP-2537: disabled + # reason: not included in berlin + # paBlsG1Add + # paBlsG1Mul + # paBlsG1MultiExp + # paBlsG2Add + # paBlsG2Mul + # paBlsG2MultiExp + # paBlsPairing + # paBlsMapG1 + # paBlsMapG2 iterator activePrecompiles*(): EthAddress = var res: EthAddress @@ -677,7 +679,9 @@ proc blsMapG2*(c: Computation) = proc getMaxPrecompileAddr(fork: Fork): PrecompileAddresses = if fork < FkByzantium: paIdentity elif fork < FkIstanbul: paPairing - elif fork < FkBerlin: paBlake2bf + # EIP 2537: disabled + # reason: not included in berlin + # elif fork < FkBerlin: paBlake2bf else: PrecompileAddresses.high proc execPrecompiles*(computation: Computation, fork: Fork): bool {.inline.} = @@ -701,15 +705,17 @@ proc execPrecompiles*(computation: Computation, fork: Fork): bool {.inline.} = of paEcMul: bn256ecMul(computation, fork) of paPairing: bn256ecPairing(computation, fork) of paBlake2bf: blake2bf(computation) - of paBlsG1Add: blsG1Add(computation) - of paBlsG1Mul: blsG1Mul(computation) - of paBlsG1MultiExp: blsG1MultiExp(computation) - of paBlsG2Add: blsG2Add(computation) - of paBlsG2Mul: blsG2Mul(computation) - of paBlsG2MultiExp: blsG2MultiExp(computation) - of paBlsPairing: blsPairing(computation) - of paBlsMapG1: blsMapG1(computation) - of paBlsMapG2: blsMapG2(computation) + # EIP 2537: disabled + # reason: not included in berlin + # of paBlsG1Add: blsG1Add(computation) + # of paBlsG1Mul: blsG1Mul(computation) + # of paBlsG1MultiExp: blsG1MultiExp(computation) + # of paBlsG2Add: blsG2Add(computation) + # of paBlsG2Mul: blsG2Mul(computation) + # of paBlsG2MultiExp: blsG2MultiExp(computation) + # of paBlsPairing: blsPairing(computation) + # of paBlsMapG1: blsMapG1(computation) + # of paBlsMapG2: blsMapG2(computation) except OutOfGas as e: # cannot use setError here, cyclic dependency computation.error = Error(info: e.msg, burnsGas: true) diff --git a/tests/test_precompiles.nim b/tests/test_precompiles.nim index 8d5a5f8af..d6f677ec6 100644 --- a/tests/test_precompiles.nim +++ b/tests/test_precompiles.nim @@ -65,15 +65,17 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) = of "bn256mul" : data.doTest(fork, paEcMul) of "ecpairing": data.doTest(fork, paPairing) of "blake2f" : data.doTest(fork, paBlake2bf) - of "blsg1add" : data.doTest(fork, paBlsG1Add) - of "blsg1mul" : data.doTest(fork, paBlsG1Mul) - of "blsg1multiexp" : data.doTest(fork, paBlsG1MultiExp) - of "blsg2add" : data.doTest(fork, paBlsG2Add) - of "blsg2mul" : data.doTest(fork, paBlsG2Mul) - of "blsg2multiexp": data.doTest(fork, paBlsG2MultiExp) - of "blspairing": data.doTest(fork, paBlsPairing) - of "blsmapg1": data.doTest(fork, paBlsMapG1) - of "blsmapg2": data.doTest(fork, paBlsMapG2) + # EIP 2537: disabled + # reason: not included in berlin + #of "blsg1add" : data.doTest(fork, paBlsG1Add) + #of "blsg1mul" : data.doTest(fork, paBlsG1Mul) + #of "blsg1multiexp" : data.doTest(fork, paBlsG1MultiExp) + #of "blsg2add" : data.doTest(fork, paBlsG2Add) + #of "blsg2mul" : data.doTest(fork, paBlsG2Mul) + #of "blsg2multiexp": data.doTest(fork, paBlsG2MultiExp) + #of "blspairing": data.doTest(fork, paBlsPairing) + #of "blsmapg1": data.doTest(fork, paBlsMapG1) + #of "blsmapg2": data.doTest(fork, paBlsMapG2) else: echo "Unknown test vector '" & $label & "'" testStatusIMPL = SKIPPED