memory expansion boilerplate usage wasn't 100% consistent, so extcodecopy and codecopy were returning far too low gas costs in many cases (#88)

This commit is contained in:
Dustin Brody 2018-07-28 07:59:33 +00:00 committed by Mamy Ratsimbazafy
parent fc09bd2874
commit dcf97d8198
2 changed files with 5 additions and 5 deletions

View File

@ -402,10 +402,10 @@ OK: 33/52 Fail: 4/52 Skip: 15/52
+ bad_indirect_jump2.json OK
+ byte1.json OK
calldatacopyMemExp.json Skip
- codecopyMemExp.json Fail
+ codecopyMemExp.json OK
+ deadCode_1.json OK
+ dupAt51becameMload.json OK
- extcodecopyMemExp.json Fail
+ extcodecopyMemExp.json OK
+ for_loop1.json OK
+ for_loop2.json OK
+ gas0.json OK
@ -483,7 +483,7 @@ OK: 33/52 Fail: 4/52 Skip: 15/52
+ swapAt52becameMstore.json OK
+ when.json OK
```
OK: 142/145 Fail: 2/145 Skip: 1/145
OK: 144/145 Fail: 0/145 Skip: 1/145
## vmLogTest
```diff
+ log0_emptyMem.json OK

View File

@ -297,7 +297,7 @@ op codecopy, inline = false, memStartPos, copyStartPos, size:
let (memPos, copyPos, len) = (memStartPos.toInt, copyStartPos.toInt, size.toInt)
computation.gasMeter.consumeGas(
computation.gasCosts[CodeCopy].m_handler(memPos, copyPos, len),
computation.gasCosts[CodeCopy].m_handler(computation.memory.len, memPos, len),
reason="CodeCopy fee")
computation.memory.writePaddedResult(computation.code.bytes, memPos, copyPos, len)
@ -319,7 +319,7 @@ op extCodeCopy, inline = true:
let (memPos, codePos, len) = (memStartPos.toInt, codeStartPos.toInt, size.toInt)
computation.gasMeter.consumeGas(
computation.gasCosts[ExtCodeCopy].m_handler(memPos, codePos, len),
computation.gasCosts[ExtCodeCopy].m_handler(computation.memory.len, memPos, len),
reason="ExtCodeCopy fee")
let codeBytes = computation.vmState.readOnlyStateDB.getCode(account)