diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 053bf35e9..9186aac4c 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -144,7 +144,7 @@ proc newComputation*(vmState: BaseVMState, message: Message, salt= 0.u256): Comp result.msg = message result.memory = Memory() result.stack = newStack() - result.returnStack = newStack() + result.returnStack = @[] result.gasMeter.init(message.gas) result.touchedAccounts = initHashSet[EthAddress]() result.suicides = initHashSet[EthAddress]() diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 108722cb3..b07eb749c 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -553,7 +553,7 @@ op returnSub, inline = true: # Other than the check that the return stack is not empty, there is no # need to validate the pc from 'returns', since we only ever push valid # values onto it via jumpsub. - c.code.pc = c.returnStack.popInt().safeInt + c.code.pc = c.returnStack.pop() op jumpSub, inline = true, jumpTarget: ## 0x5e, Transfers control to a subroutine. @@ -571,7 +571,7 @@ op jumpSub, inline = true, jumpTarget: if c.returnStack.len == 1023: raise newException(FullStack, "Out of returnStack") - c.returnStack.push returnPC + c.returnStack.add returnPC inc c.code.pc # ########################################## diff --git a/nimbus/vm_types.nim b/nimbus/vm_types.nim index 7cfccd617..747f4da21 100644 --- a/nimbus/vm_types.nim +++ b/nimbus/vm_types.nim @@ -68,7 +68,7 @@ type msg*: Message memory*: Memory stack*: Stack - returnStack*: Stack + returnStack*: seq[int] gasMeter*: GasMeter code*: CodeStream output*: seq[byte]