fix callcode insufficient funds, GST +6

This commit is contained in:
andri lim 2019-03-16 22:54:24 +07:00
parent 990bc44c65
commit d0822c26d1
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 19 additions and 24 deletions

View File

@ -445,14 +445,14 @@ OK: 7/34 Fail: 0/34 Skip: 27/34
CreateAndGasInsideCreate.json Skip
DelegateCallOnEIP.json Skip
ExecuteCallThatAskForeGasThenTrabsactionHas.json Skip
NewGasPriceForCodes.json Skip
+ NewGasPriceForCodes.json OK
SuicideToExistingContract.json Skip
SuicideToNotExistingContract.json Skip
Transaction64Rule_d64e0.json Skip
Transaction64Rule_d64m1.json Skip
Transaction64Rule_d64p1.json Skip
```
OK: 0/13 Fail: 0/13 Skip: 13/13
OK: 1/13 Fail: 0/13 Skip: 12/13
## stEIP150singleCodeGasPrices
```diff
+ RawBalanceGas.json OK
@ -592,9 +592,9 @@ OK: 46/46 Fail: 0/46 Skip: 0/46
+ CreateAndGasInsideCreateWithMemExpandingCalls.json OK
+ DelegateCallOnEIPWithMemExpandingCalls.json OK
+ ExecuteCallThatAskMoreGasThenTransactionHasWithMemExpandingCalls.jsonOK
NewGasPriceForCodesWithMemExpandingCalls.json Skip
+ NewGasPriceForCodesWithMemExpandingCalls.json OK
```
OK: 7/8 Fail: 0/8 Skip: 1/8
OK: 8/8 Fail: 0/8 Skip: 0/8
## stMemoryStressTest
```diff
CALLCODE_Bounds.json Skip
@ -713,7 +713,7 @@ OK: 67/67 Fail: 0/67 Skip: 0/67
+ NonZeroValue_CALL.json OK
+ NonZeroValue_CALLCODE.json OK
+ NonZeroValue_CALLCODE_ToEmpty.json OK
NonZeroValue_CALLCODE_ToNonNonZeroBalance.json Skip
+ NonZeroValue_CALLCODE_ToNonNonZeroBalance.json OK
+ NonZeroValue_CALLCODE_ToOneStorageKey.json OK
+ NonZeroValue_CALL_ToEmpty.json OK
+ NonZeroValue_CALL_ToNonNonZeroBalance.json OK
@ -735,7 +735,7 @@ OK: 67/67 Fail: 0/67 Skip: 0/67
+ NonZeroValue_TransactionCALLwithData_ToNonNonZeroBalance.json OK
+ NonZeroValue_TransactionCALLwithData_ToOneStorageKey.json OK
```
OK: 23/24 Fail: 0/24 Skip: 1/24
OK: 24/24 Fail: 0/24 Skip: 0/24
## stPreCompiledContracts
```diff
identity_to_bigger.json Skip
@ -1099,7 +1099,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
+ randomStatetest245.json OK
+ randomStatetest246.json OK
+ randomStatetest247.json OK
randomStatetest248.json Skip
+ randomStatetest248.json OK
+ 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: 317/327 Fail: 0/327 Skip: 10/327
OK: 318/327 Fail: 0/327 Skip: 9/327
## stRandom2
```diff
+ 201503110226PYTHON_DUP6.json OK
@ -1609,10 +1609,10 @@ OK: 34/37 Fail: 0/37 Skip: 3/37
RevertOpcodeDirectCall.json Skip
RevertOpcodeInCallsOnNonEmptyReturnData.json Skip
+ RevertOpcodeInCreateReturns.json OK
RevertOpcodeInInit.json Skip
+ RevertOpcodeInInit.json OK
RevertOpcodeMultipleSubCalls.json Skip
RevertOpcodeReturn.json Skip
RevertOpcodeWithBigOutputInInit.json Skip
+ RevertOpcodeWithBigOutputInInit.json OK
RevertPrecompiledTouch.json Skip
RevertPrecompiledTouchCC.json Skip
RevertPrecompiledTouchDC.json Skip
@ -1632,7 +1632,7 @@ OK: 34/37 Fail: 0/37 Skip: 3/37
+ TouchToEmptyAccountRevert2.json OK
+ TouchToEmptyAccountRevert3.json OK
```
OK: 31/43 Fail: 0/43 Skip: 12/43
OK: 33/43 Fail: 0/43 Skip: 10/43
## stShift
```diff
sar00.json Skip
@ -2520,4 +2520,4 @@ OK: 0/133 Fail: 0/133 Skip: 133/133
OK: 0/130 Fail: 0/130 Skip: 130/130
---TOTAL---
OK: 1239/2334 Fail: 0/2334 Skip: 1095/2334
OK: 1245/2334 Fail: 0/2334 Skip: 1089/2334

View File

@ -112,7 +112,7 @@ proc commit*(snapshot: var ComputationSnapshot) {.inline.} =
proc dispose*(snapshot: var ComputationSnapshot) {.inline.} =
snapshot.snapshot.dispose()
proc transferBalance(computation: var BaseComputation) =
proc transferBalance(computation: var BaseComputation, opCode: static[Op]) =
if computation.msg.depth >= MaxCallDepth:
raise newException(StackDepthError, "Stack depth limit reached")
@ -123,17 +123,18 @@ proc transferBalance(computation: var BaseComputation) =
raise newException(InsufficientFunds,
&"Insufficient funds: {senderBalance} < {computation.msg.value}")
computation.vmState.mutateStateDb:
db.subBalance(computation.msg.sender, computation.msg.value)
db.addBalance(computation.msg.storageAddress, computation.msg.value)
when opCode in {Call, Create}:
computation.vmState.mutateStateDb:
db.subBalance(computation.msg.sender, computation.msg.value)
db.addBalance(computation.msg.storageAddress, computation.msg.value)
proc applyMessage(computation: var BaseComputation, opCode: static[Op]): bool =
var snapshot = computation.snapshot()
defer: snapshot.dispose()
when opCode in {Call, Create}:
when opCode in {CallCode, Call, Create}:
try:
computation.transferBalance()
computation.transferBalance(opCode)
except VMError:
snapshot.revert()
debug "transferBalance failed", msg = computation.error.info

View File

@ -50,14 +50,11 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest14.json",
"randomStatetest184.json",
"randomStatetest85.json",
"randomStatetest248.json",
"RevertOpcodeCalls.json",
"RevertOpcodeDirectCall.json",
"RevertOpcodeInCallsOnNonEmptyReturnData.json",
"RevertOpcodeInInit.json",
"RevertOpcodeMultipleSubCalls.json",
"RevertOpcodeReturn.json",
"RevertOpcodeWithBigOutputInInit.json",
"tx_e1c174e2.json",
"suicideCoinbase.json",
"Opcodes_TransactionInit.json",
@ -72,9 +69,6 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
"randomStatetest101.json",
"randomStatetest7.json",
# 2019-02-17:
"NewGasPriceForCodes.json",
"NewGasPriceForCodesWithMemExpandingCalls.json",
"NonZeroValue_CALLCODE_ToNonNonZeroBalance.json",
"pairingTest.json",
"pointAdd.json",
"pointAddTrunc.json",