fix writePaddedResult, GST +4
This commit is contained in:
parent
adb1286e28
commit
433ccba15f
|
@ -639,10 +639,10 @@ OK: 7/8 Fail: 0/8 Skip: 1/8
|
|||
OK: 5/38 Fail: 0/38 Skip: 33/38
|
||||
## stMemoryTest
|
||||
```diff
|
||||
callDataCopyOffset.json Skip
|
||||
+ callDataCopyOffset.json OK
|
||||
+ calldatacopy_dejavu.json OK
|
||||
+ calldatacopy_dejavu2.json OK
|
||||
codeCopyOffset.json Skip
|
||||
+ codeCopyOffset.json OK
|
||||
+ codecopy_dejavu.json OK
|
||||
+ codecopy_dejavu2.json OK
|
||||
+ extcodecopy_dejavu.json OK
|
||||
|
@ -707,7 +707,7 @@ OK: 5/38 Fail: 0/38 Skip: 33/38
|
|||
+ stackLimitPush32_1024.json OK
|
||||
+ stackLimitPush32_1025.json OK
|
||||
```
|
||||
OK: 65/67 Fail: 0/67 Skip: 2/67
|
||||
OK: 67/67 Fail: 0/67 Skip: 0/67
|
||||
## stNonZeroCallsTest
|
||||
```diff
|
||||
+ NonZeroValue_CALL.json OK
|
||||
|
@ -974,7 +974,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
|
|||
+ randomStatetest112.json OK
|
||||
+ randomStatetest114.json OK
|
||||
+ randomStatetest115.json OK
|
||||
randomStatetest116.json Skip
|
||||
+ randomStatetest116.json OK
|
||||
+ randomStatetest117.json OK
|
||||
+ randomStatetest118.json OK
|
||||
+ randomStatetest119.json OK
|
||||
|
@ -1089,7 +1089,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
|
|||
+ randomStatetest232.json OK
|
||||
+ randomStatetest233.json OK
|
||||
+ randomStatetest236.json OK
|
||||
randomStatetest237.json Skip
|
||||
+ randomStatetest237.json OK
|
||||
+ randomStatetest238.json OK
|
||||
+ randomStatetest24.json OK
|
||||
+ randomStatetest241.json OK
|
||||
|
@ -1284,7 +1284,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
|
|||
+ randomStatetest97.json OK
|
||||
+ randomStatetest98.json OK
|
||||
```
|
||||
OK: 315/327 Fail: 0/327 Skip: 12/327
|
||||
OK: 317/327 Fail: 0/327 Skip: 10/327
|
||||
## stRandom2
|
||||
```diff
|
||||
+ 201503110226PYTHON_DUP6.json OK
|
||||
|
@ -2520,4 +2520,4 @@ OK: 0/133 Fail: 0/133 Skip: 133/133
|
|||
OK: 0/130 Fail: 0/130 Skip: 130/130
|
||||
|
||||
---TOTAL---
|
||||
OK: 1230/2334 Fail: 0/2334 Skip: 1104/2334
|
||||
OK: 1234/2334 Fail: 0/2334 Skip: 1100/2334
|
||||
|
|
|
@ -220,18 +220,16 @@ proc writePaddedResult(mem: var Memory,
|
|||
data: openarray[byte],
|
||||
memPos, dataPos, len: Natural,
|
||||
paddingValue = 0.byte) =
|
||||
let prevLen = mem.len
|
||||
|
||||
mem.extend(memPos, len)
|
||||
let dataEndPosition = dataPos.int64 + len - 1
|
||||
let sourceBytes = data[min(dataPos, data.len) .. min(data.len - 1, dataEndPosition)]
|
||||
mem.write(memPos, sourceBytes)
|
||||
|
||||
# geth doesn't do padding, it causes block validation error
|
||||
when false:
|
||||
# Don't duplicate zero-padding of mem.extend
|
||||
let paddingOffset = memPos + sourceBytes.len
|
||||
# TODO: avoid unnecessary memory allocation
|
||||
mem.write(paddingOffset, repeat(paddingValue, max(prevLen - paddingOffset, 0)))
|
||||
|
||||
# Don't duplicate zero-padding of mem.extend
|
||||
let paddingOffset = memPos + sourceBytes.len
|
||||
# TODO: avoid unnecessary memory allocation
|
||||
mem.write(paddingOffset, repeat(paddingValue, min(mem.len - paddingOffset, len)))
|
||||
|
||||
op address, inline = true:
|
||||
## 0x30, Get address of currently executing account.
|
||||
|
@ -257,7 +255,6 @@ op callValue, inline = true:
|
|||
|
||||
op callDataLoad, inline = false, startPos:
|
||||
## 0x35, Get input data of current environment
|
||||
# TODO simplification: https://github.com/status-im/nimbus/issues/67
|
||||
let dataPos = startPos.cleanMemRef
|
||||
if dataPos >= computation.msg.data.len:
|
||||
push: 0
|
||||
|
@ -295,11 +292,11 @@ op callDataCopy, inline = false, memStartPos, copyStartPos, size:
|
|||
|
||||
computation.memory.writePaddedResult(computation.msg.data, memPos, copyPos, len)
|
||||
|
||||
op codesize, inline = true:
|
||||
op codeSize, inline = true:
|
||||
## 0x38, Get size of code running in current environment.
|
||||
push: computation.code.len
|
||||
|
||||
op codecopy, inline = false, memStartPos, copyStartPos, size:
|
||||
op codeCopy, inline = false, memStartPos, copyStartPos, size:
|
||||
## 0x39, Copy code running in current environment to memory.
|
||||
# TODO tests: https://github.com/status-im/nimbus/issues/67
|
||||
|
||||
|
@ -344,7 +341,7 @@ op returnDataCopy, inline = false, memStartPos, copyStartPos, size:
|
|||
|
||||
computation.gasMeter.consumeGas(
|
||||
computation.gasCosts[CodeCopy].m_handler(memPos, copyPos, len),
|
||||
reason="ExtCodeCopy fee")
|
||||
reason="returnDataCopy fee")
|
||||
|
||||
if copyPos + len > computation.returnData.len:
|
||||
# TODO Geth additionally checks copyPos + len < 64
|
||||
|
|
|
@ -48,8 +48,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
|
|||
"delegatecodeDynamicCode2SelfCall.json",
|
||||
"OutOfGasContractCreation.json",
|
||||
"OutOfGasPrefundedContractCreation.json",
|
||||
"callDataCopyOffset.json",
|
||||
"codeCopyOffset.json",
|
||||
"CALLCODEEcrecoverV_prefixedf0.json",
|
||||
"randomStatetest14.json",
|
||||
"randomStatetest184.json",
|
||||
|
@ -77,8 +75,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
|
|||
# 2019-02-07:
|
||||
# 2019-02-15:
|
||||
"randomStatetest101.json",
|
||||
"randomStatetest116.json",
|
||||
"randomStatetest237.json",
|
||||
"randomStatetest7.json",
|
||||
# 2019-02-17:
|
||||
"NewGasPriceForCodes.json",
|
||||
|
|
Loading…
Reference in New Issue