Remove endian code, precompiles should now run. Removed raise as case stmt is full now.
This commit is contained in:
parent
434edcc2ae
commit
7ba1cfaf13
|
@ -243,15 +243,10 @@ proc bn256ecPairing*(computation: var BaseComputation) =
|
||||||
computation.rawOutput = @output
|
computation.rawOutput = @output
|
||||||
|
|
||||||
proc execPrecompiles*(computation: var BaseComputation): bool {.inline.} =
|
proc execPrecompiles*(computation: var BaseComputation): bool {.inline.} =
|
||||||
const
|
for i in 0..18:
|
||||||
bRange = when system.cpuEndian == bigEndian: 0..18 else: 1..19
|
|
||||||
bOffset = when system.cpuEndian == bigEndian: 19 else: 0
|
|
||||||
|
|
||||||
for i in bRange:
|
|
||||||
if computation.msg.codeAddress[i] != 0: return
|
if computation.msg.codeAddress[i] != 0: return
|
||||||
|
|
||||||
let lb = computation.msg.codeAddress[bOffset]
|
let lb = computation.msg.codeAddress[19]
|
||||||
|
|
||||||
if lb in PrecompileAddresses.low.byte .. PrecompileAddresses.high.byte:
|
if lb in PrecompileAddresses.low.byte .. PrecompileAddresses.high.byte:
|
||||||
result = true
|
result = true
|
||||||
let precompile = PrecompileAddresses(lb)
|
let precompile = PrecompileAddresses(lb)
|
||||||
|
@ -265,5 +260,3 @@ proc execPrecompiles*(computation: var BaseComputation): bool {.inline.} =
|
||||||
of paEcAdd: bn256ecAdd(computation)
|
of paEcAdd: bn256ecAdd(computation)
|
||||||
of paEcMul: bn256ecMul(computation)
|
of paEcMul: bn256ecMul(computation)
|
||||||
of paPairing: bn256ecPairing(computation)
|
of paPairing: bn256ecPairing(computation)
|
||||||
else:
|
|
||||||
raise newException(ValidationError, "Unknown precompile address " & $lb)
|
|
||||||
|
|
Loading…
Reference in New Issue