diff --git a/nimbus/constants.nim b/nimbus/constants.nim index f97175fc6..048e10320 100644 --- a/nimbus/constants.nim +++ b/nimbus/constants.nim @@ -11,7 +11,6 @@ const ZERO_ADDRESS* = default(EthAddress) CREATE_CONTRACT_ADDRESS* = ZERO_ADDRESS ZERO_HASH32* = Hash256() - STACK_DEPTH_LIMIT* = 1024 GAS_LIMIT_EMA_DENOMINATOR* = 1_024 GAS_LIMIT_ADJUSTMENT_FACTOR* = 1_024 diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index d7969273f..3d190a3fc 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -110,7 +110,7 @@ proc dispose*(snapshot: var ComputationSnapshot) {.inline.} = snapshot.snapshot.dispose() proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) = - if computation.msg.depth > STACK_DEPTH_LIMIT: + if computation.msg.depth >= MaxCallDepth: raise newException(StackDepthError, "Stack depth limit reached") if computation.msg.value != 0: @@ -124,25 +124,6 @@ proc applyMessageAux(computation: var BaseComputation, opCode: static[Op]) = &"Insufficient funds: {senderBalance} < {computation.msg.value}" ) - let - insufficientFunds = senderBalance < computation.msg.value - stackTooDeep = computation.msg.depth >= MaxCallDepth - - if insufficientFunds or stackTooDeep: - computation.returnData = @[] - var errMessage: string - 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 - computation.gasMeter.returnGas(computation.msg.gas) - push: 0 - return - newBalance = senderBalance - computation.msg.value computation.vmState.mutateStateDb: db.setBalance(computation.msg.sender, newBalance)