mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
fix callcode regression
This commit is contained in:
parent
85d8155177
commit
dcf7699358
@ -1099,7 +1099,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
|
|||||||
+ randomStatetest245.json OK
|
+ randomStatetest245.json OK
|
||||||
+ randomStatetest246.json OK
|
+ randomStatetest246.json OK
|
||||||
+ randomStatetest247.json OK
|
+ randomStatetest247.json OK
|
||||||
+ randomStatetest248.json OK
|
randomStatetest248.json Skip
|
||||||
+ randomStatetest249.json OK
|
+ randomStatetest249.json OK
|
||||||
+ randomStatetest25.json OK
|
+ randomStatetest25.json OK
|
||||||
+ randomStatetest250.json OK
|
+ randomStatetest250.json OK
|
||||||
@ -1284,7 +1284,7 @@ OK: 0/16 Fail: 0/16 Skip: 16/16
|
|||||||
+ randomStatetest97.json OK
|
+ randomStatetest97.json OK
|
||||||
+ randomStatetest98.json OK
|
+ randomStatetest98.json OK
|
||||||
```
|
```
|
||||||
OK: 314/327 Fail: 0/327 Skip: 13/327
|
OK: 313/327 Fail: 0/327 Skip: 14/327
|
||||||
## stRandom2
|
## stRandom2
|
||||||
```diff
|
```diff
|
||||||
+ 201503110226PYTHON_DUP6.json OK
|
+ 201503110226PYTHON_DUP6.json OK
|
||||||
@ -1458,7 +1458,7 @@ OK: 314/327 Fail: 0/327 Skip: 13/327
|
|||||||
+ randomStatetest576.json OK
|
+ randomStatetest576.json OK
|
||||||
+ randomStatetest577.json OK
|
+ randomStatetest577.json OK
|
||||||
+ randomStatetest578.json OK
|
+ randomStatetest578.json OK
|
||||||
randomStatetest579.json Skip
|
+ randomStatetest579.json OK
|
||||||
+ randomStatetest580.json OK
|
+ randomStatetest580.json OK
|
||||||
+ randomStatetest581.json OK
|
+ randomStatetest581.json OK
|
||||||
+ randomStatetest582.json OK
|
+ randomStatetest582.json OK
|
||||||
@ -1515,7 +1515,7 @@ OK: 314/327 Fail: 0/327 Skip: 13/327
|
|||||||
randomStatetest646.json Skip
|
randomStatetest646.json Skip
|
||||||
randomStatetest647.json Skip
|
randomStatetest647.json Skip
|
||||||
```
|
```
|
||||||
OK: 218/227 Fail: 0/227 Skip: 9/227
|
OK: 219/227 Fail: 0/227 Skip: 8/227
|
||||||
## stRecursiveCreate
|
## stRecursiveCreate
|
||||||
```diff
|
```diff
|
||||||
recursiveCreate.json Skip
|
recursiveCreate.json Skip
|
||||||
|
@ -123,40 +123,39 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) =
|
|||||||
raise newException(InsufficientFunds,
|
raise newException(InsufficientFunds,
|
||||||
&"Insufficient funds: {senderBalance} < {computation.msg.value}"
|
&"Insufficient funds: {senderBalance} < {computation.msg.value}"
|
||||||
)
|
)
|
||||||
when opCode in {Call, CallCode}:
|
|
||||||
let
|
|
||||||
insufficientFunds = senderBalance < computation.msg.value
|
|
||||||
stackTooDeep = computation.msg.depth >= MaxCallDepth
|
|
||||||
|
|
||||||
if insufficientFunds or stackTooDeep:
|
let
|
||||||
computation.returnData = @[]
|
insufficientFunds = senderBalance < computation.msg.value
|
||||||
var errMessage: string
|
stackTooDeep = computation.msg.depth >= MaxCallDepth
|
||||||
if insufficientFunds:
|
|
||||||
errMessage = &"Insufficient Funds: have: {$senderBalance} need: {$computation.msg.value}"
|
|
||||||
elif stackTooDeep:
|
|
||||||
errMessage = "Stack Limit Reached"
|
|
||||||
else:
|
|
||||||
raise newException(VMError, "Invariant: Unreachable code path")
|
|
||||||
|
|
||||||
debug "Computation failure", msg = errMessage
|
if insufficientFunds or stackTooDeep:
|
||||||
computation.gasMeter.returnGas(computation.msg.gas)
|
computation.returnData = @[]
|
||||||
push: 0
|
var errMessage: string
|
||||||
return
|
if insufficientFunds:
|
||||||
|
errMessage = &"Insufficient Funds: have: {$senderBalance} need: {$computation.msg.value}"
|
||||||
|
elif stackTooDeep:
|
||||||
|
errMessage = "Stack Limit Reached"
|
||||||
|
else:
|
||||||
|
raise newException(VMError, "Invariant: Unreachable code path")
|
||||||
|
|
||||||
when opCode == Call:
|
debug "Computation failure", msg = errMessage
|
||||||
newBalance = senderBalance - computation.msg.value
|
computation.gasMeter.returnGas(computation.msg.gas)
|
||||||
computation.vmState.mutateStateDb:
|
push: 0
|
||||||
db.setBalance(computation.msg.sender, newBalance)
|
return
|
||||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
|
||||||
|
|
||||||
trace "Value transferred",
|
newBalance = senderBalance - computation.msg.value
|
||||||
source = computation.msg.sender,
|
computation.vmState.mutateStateDb:
|
||||||
dest = computation.msg.storageAddress,
|
db.setBalance(computation.msg.sender, newBalance)
|
||||||
value = computation.msg.value,
|
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||||
oldSenderBalance = senderBalance,
|
|
||||||
newSenderBalance = newBalance,
|
trace "Value transferred",
|
||||||
gasPrice = computation.msg.gasPrice,
|
source = computation.msg.sender,
|
||||||
gas = computation.msg.gas
|
dest = computation.msg.storageAddress,
|
||||||
|
value = computation.msg.value,
|
||||||
|
oldSenderBalance = senderBalance,
|
||||||
|
newSenderBalance = newBalance,
|
||||||
|
gasPrice = computation.msg.gasPrice,
|
||||||
|
gas = computation.msg.gas
|
||||||
|
|
||||||
trace "Apply message",
|
trace "Apply message",
|
||||||
value = computation.msg.value,
|
value = computation.msg.value,
|
||||||
@ -168,20 +167,20 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) =
|
|||||||
else:
|
else:
|
||||||
# even though the value is zero, the account
|
# even though the value is zero, the account
|
||||||
# should be exist.
|
# should be exist.
|
||||||
when opCode == Call:
|
computation.vmState.mutateStateDb:
|
||||||
computation.vmState.mutateStateDb:
|
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
||||||
db.addBalance(computation.msg.storageAddress, computation.msg.value)
|
|
||||||
|
|
||||||
proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
|
proc applyMessage(computation: var BaseComputation, opCode: static[Op]) =
|
||||||
var snapshot = computation.snapshot()
|
var snapshot = computation.snapshot()
|
||||||
defer: snapshot.dispose()
|
defer: snapshot.dispose()
|
||||||
|
|
||||||
try:
|
when opCode == Call:
|
||||||
computation.applyMessageAux(opCode)
|
try:
|
||||||
except VMError:
|
computation.applyMessageAux(opCode)
|
||||||
snapshot.revert()
|
except VMError:
|
||||||
debug "applyMessageAux failed", msg = computation.error.info
|
snapshot.revert()
|
||||||
return
|
debug "applyMessageAux failed", msg = computation.error.info
|
||||||
|
return
|
||||||
|
|
||||||
if computation.gasMeter.gasRemaining <= 0:
|
if computation.gasMeter.gasRemaining <= 0:
|
||||||
snapshot.commit()
|
snapshot.commit()
|
||||||
|
@ -626,7 +626,7 @@ proc callCodeParams(computation: var BaseComputation): (UInt256, UInt256, EthAdd
|
|||||||
value,
|
value,
|
||||||
to,
|
to,
|
||||||
ZERO_ADDRESS, # sender
|
ZERO_ADDRESS, # sender
|
||||||
ZERO_ADDRESS, # code_address
|
to, # code_address
|
||||||
memoryInputStartPosition,
|
memoryInputStartPosition,
|
||||||
memoryInputSize,
|
memoryInputSize,
|
||||||
memoryOutputStartPosition,
|
memoryOutputStartPosition,
|
||||||
@ -738,7 +738,7 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
|||||||
|
|
||||||
if opCode == CallCode:
|
if opCode == CallCode:
|
||||||
childMsg.storageAddress = computation.msg.storageAddress
|
childMsg.storageAddress = computation.msg.storageAddress
|
||||||
|
|
||||||
var childComputation = applyChildComputation(computation, childMsg, opCode)
|
var childComputation = applyChildComputation(computation, childMsg, opCode)
|
||||||
|
|
||||||
if childComputation.isError:
|
if childComputation.isError:
|
||||||
@ -755,7 +755,7 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
|||||||
computation.gasMeter.returnGas(childComputation.gasMeter.gasRemaining)
|
computation.gasMeter.returnGas(childComputation.gasMeter.gasRemaining)
|
||||||
|
|
||||||
if computation.gasMeter.gasRemaining <= 0:
|
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(call, Call)
|
||||||
genCall(callCode, CallCode)
|
genCall(callCode, CallCode)
|
||||||
|
@ -131,11 +131,12 @@ func allowedFailingGeneralStateTest*(folder, name: string): bool =
|
|||||||
"randomStatetest307.json",
|
"randomStatetest307.json",
|
||||||
"randomStatetest368.json",
|
"randomStatetest368.json",
|
||||||
"randomStatetest85.json",
|
"randomStatetest85.json",
|
||||||
"randomStatetest579.json",
|
#"randomStatetest579.json",
|
||||||
"randomStatetest643.json",
|
"randomStatetest643.json",
|
||||||
"randomStatetest644.json",
|
"randomStatetest644.json",
|
||||||
"randomStatetest645.json",
|
"randomStatetest645.json",
|
||||||
"randomStatetest646.json",
|
"randomStatetest646.json",
|
||||||
|
"randomStatetest248.json",
|
||||||
"refundSuicide50procentCap.json",
|
"refundSuicide50procentCap.json",
|
||||||
"refund_CallToSuicideNoStorage.json",
|
"refund_CallToSuicideNoStorage.json",
|
||||||
"refund_CallToSuicideStorage.json",
|
"refund_CallToSuicideStorage.json",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user