fix callcode regression

This commit is contained in:
andri lim 2019-02-20 18:02:14 +07:00 committed by zah
parent 85d8155177
commit dcf7699358
4 changed files with 47 additions and 47 deletions

View File

@ -1099,7 +1099,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest245.json OK
+ randomStatetest246.json OK
+ randomStatetest247.json OK
+ randomStatetest248.json OK
randomStatetest248.json Skip
+ randomStatetest249.json OK
+ randomStatetest25.json OK
+ randomStatetest250.json OK
@ -1284,7 +1284,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest97.json OK
+ randomStatetest98.json OK
```
OK: 314/327 Fail: 0/327 Skip: 13/327
OK: 313/327 Fail: 0/327 Skip: 14/327
## stRandom2
```diff
+ 201503110226PYTHON_DUP6.json OK
@ -1458,7 +1458,7 @@ OK: 314/327 Fail: 0/327 Skip: 13/327
+ randomStatetest576.json OK
+ randomStatetest577.json OK
+ randomStatetest578.json OK
randomStatetest579.json Skip
+ randomStatetest579.json OK
+ randomStatetest580.json OK
+ randomStatetest581.json OK
+ randomStatetest582.json OK
@ -1515,7 +1515,7 @@ OK: 314/327 Fail: 0/327 Skip: 13/327
randomStatetest646.json Skip
randomStatetest647.json Skip
```
OK: 218/227 Fail: 0/227 Skip: 9/227
OK: 219/227 Fail: 0/227 Skip: 8/227
## stRecursiveCreate
```diff
recursiveCreate.json Skip

View File

@ -123,7 +123,7 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) =
raise newException(InsufficientFunds,
&"Insufficient funds: {senderBalance} < {computation.msg.value}"
)
when opCode in {Call, CallCode}:
let
insufficientFunds = senderBalance < computation.msg.value
stackTooDeep = computation.msg.depth >= MaxCallDepth
@ -143,7 +143,6 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) =
push: 0
return
when opCode == Call:
newBalance = senderBalance - computation.msg.value
computation.vmState.mutateStateDb:
db.setBalance(computation.msg.sender, newBalance)
@ -168,7 +167,6 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) =
else:
# even though the value is zero, the account
# should be exist.
when opCode == Call:
computation.vmState.mutateStateDb:
db.addBalance(computation.msg.storageAddress, computation.msg.value)
@ -176,6 +174,7 @@ proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
var snapshot = computation.snapshot()
defer: snapshot.dispose()
when opCode == Call:
try:
computation.applyMessageAux(opCode)
except VMError:

View File

@ -626,7 +626,7 @@ proc callCodeParams(computation: var BaseComputation): (UInt256, UInt256, EthAdd
value,
to,
ZERO_ADDRESS, # sender
ZERO_ADDRESS, # code_address
to, # code_address
memoryInputStartPosition,
memoryInputSize,
memoryOutputStartPosition,
@ -755,7 +755,7 @@ template genCall(callName: untyped, opCode: Op): untyped =
computation.gasMeter.returnGas(childComputation.gasMeter.gasRemaining)
if computation.gasMeter.gasRemaining <= 0:
raise newException(OutOfGas, "computation out of gas after contract call")
raise newException(OutOfGas, "computation out of gas after contract call (" & callName.astToStr & ")")
genCall(call, Call)
genCall(callCode, CallCode)

View File

@ -131,11 +131,12 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest307.json",
"randomStatetest368.json",
"randomStatetest85.json",
"randomStatetest579.json",
#"randomStatetest579.json",
"randomStatetest643.json",
"randomStatetest644.json",
"randomStatetest645.json",
"randomStatetest646.json",
"randomStatetest248.json",
"refundSuicide50procentCap.json",
"refund_CallToSuicideNoStorage.json",
"refund_CallToSuicideStorage.json",