mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-03 15:55:47 +00:00
fix ecRecover precompiles, GST +1
This commit is contained in:
parent
ba47d3c997
commit
03ea1c5a85
@ -833,9 +833,9 @@ OK: 24/24 Fail: 0/24 Skip: 0/24
|
||||
+ modexp_9_37111_37111_22000.json OK
|
||||
+ modexp_9_37111_37111_35000.json OK
|
||||
+ modexp_9_3711_37111_25000.json OK
|
||||
sec80.json Skip
|
||||
+ sec80.json OK
|
||||
```
|
||||
OK: 59/96 Fail: 0/96 Skip: 37/96
|
||||
OK: 60/96 Fail: 0/96 Skip: 36/96
|
||||
## stPreCompiledContracts2
|
||||
```diff
|
||||
+ CALLCODEEcrecover0.json OK
|
||||
@ -2520,4 +2520,4 @@ OK: 130/133 Fail: 0/133 Skip: 3/133
|
||||
OK: 130/130 Fail: 0/130 Skip: 0/130
|
||||
|
||||
---TOTAL---
|
||||
OK: 2181/2334 Fail: 0/2334 Skip: 153/2334
|
||||
OK: 2182/2334 Fail: 0/2334 Skip: 152/2334
|
||||
|
@ -21,21 +21,26 @@ proc getSignature*(computation: BaseComputation): (array[32, byte], Signature) =
|
||||
template data: untyped = computation.msg.data
|
||||
var bytes: array[65, byte]
|
||||
let maxPos = min(data.high, 127)
|
||||
if maxPos >= 32:
|
||||
if maxPos >= 31:
|
||||
# extract message hash
|
||||
result[0][0..31] = data[0..31]
|
||||
if maxPos >= 127:
|
||||
# Copy message data to buffer
|
||||
# Note that we need to rearrange to R, S, V
|
||||
bytes[0..63] = data[64..127]
|
||||
var VOK = true
|
||||
let v = data[63]
|
||||
for x in 32..<63:
|
||||
if data[x] != 0: VOK = false
|
||||
VOK = VOK and v.int in 27..28
|
||||
if not VOK:
|
||||
raise newException(ValidationError, "Invalid V in getSignature")
|
||||
bytes[64] = v - 27
|
||||
elif maxPos >= 64:
|
||||
bytes[0..(maxPos-64)] = data[64..maxPos]
|
||||
else:
|
||||
result[0][0..maxPos] = data[0..maxPos]
|
||||
|
||||
var VOK = true
|
||||
let v = data[63]
|
||||
for x in 32..<63:
|
||||
if data[x] != 0: VOK = false
|
||||
VOK = VOK and v.int in 27..28
|
||||
if not VOK:
|
||||
raise newException(ValidationError, "Invalid V in getSignature")
|
||||
bytes[64] = v - 27
|
||||
|
||||
if recoverSignature(bytes, result[1]) != EthKeysStatus.Success:
|
||||
raise newException(ValidationError, "Could not recover signature computation")
|
||||
|
@ -15,10 +15,9 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
|
||||
let allowedFailingGeneralStateTests = @[
|
||||
"randomStatetest14.json", # SHA3 offset
|
||||
"randomStatetest85.json", # CALL* memoffset
|
||||
"sha3_deja.json", # SHA3 startPos
|
||||
|
||||
"sec80.json",
|
||||
"txCost-sec73.json",
|
||||
"sha3_deja.json",
|
||||
"CreateOOGafterInitCodeReturndataSize.json",
|
||||
"RevertInCreateInInit.json",
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user