Merge branch 'jangko-fix_maxcalldepth'

This commit is contained in:
Ștefan Talpalaru 2019-03-28 15:12:46 +01:00
commit 7b26bf1cee
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 5 additions and 2 deletions

View File

@ -144,7 +144,7 @@ proc writeContract*(computation: var BaseComputation, fork: Fork): bool =
result = false result = false
proc transferBalance(computation: var BaseComputation, opCode: static[Op]): bool = proc transferBalance(computation: var BaseComputation, opCode: static[Op]): bool =
if computation.msg.depth >= MaxCallDepth: if computation.msg.depth > MaxCallDepth:
debug "Stack depth limit reached", depth=computation.msg.depth debug "Stack depth limit reached", depth=computation.msg.depth
return false return false

View File

@ -528,7 +528,10 @@ proc canTransfer(computation: BaseComputation, memPos, memLen: int, value: Uint2
debug "Computation Failure", reason = "Insufficient funds available to transfer", required = computation.msg.value, balance = senderBalance debug "Computation Failure", reason = "Insufficient funds available to transfer", required = computation.msg.value, balance = senderBalance
return false return false
if computation.msg.depth >= MaxCallDepth: # unlike the other MaxCallDepth comparison,
# this one has not been entered child computation
# thats why it has `+ 1`
if computation.msg.depth + 1 > MaxCallDepth:
debug "Computation Failure", reason = "Stack too deep", maximumDepth = MaxCallDepth, depth = computation.msg.depth debug "Computation Failure", reason = "Stack too deep", maximumDepth = MaxCallDepth, depth = computation.msg.depth
return false return false