returnStack: use seq[int] instead of Uint256 Stack

This commit is contained in:
jangko 2020-11-25 19:09:16 +07:00
parent a263e6b1a6
commit 56bc1205e5
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 4 additions and 4 deletions

View File

@ -144,7 +144,7 @@ proc newComputation*(vmState: BaseVMState, message: Message, salt= 0.u256): Comp
result.msg = message result.msg = message
result.memory = Memory() result.memory = Memory()
result.stack = newStack() result.stack = newStack()
result.returnStack = newStack() result.returnStack = @[]
result.gasMeter.init(message.gas) result.gasMeter.init(message.gas)
result.touchedAccounts = initHashSet[EthAddress]() result.touchedAccounts = initHashSet[EthAddress]()
result.suicides = initHashSet[EthAddress]() result.suicides = initHashSet[EthAddress]()

View File

@ -553,7 +553,7 @@ op returnSub, inline = true:
# Other than the check that the return stack is not empty, there is no # 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 # need to validate the pc from 'returns', since we only ever push valid
# values onto it via jumpsub. # values onto it via jumpsub.
c.code.pc = c.returnStack.popInt().safeInt c.code.pc = c.returnStack.pop()
op jumpSub, inline = true, jumpTarget: op jumpSub, inline = true, jumpTarget:
## 0x5e, Transfers control to a subroutine. ## 0x5e, Transfers control to a subroutine.
@ -571,7 +571,7 @@ op jumpSub, inline = true, jumpTarget:
if c.returnStack.len == 1023: if c.returnStack.len == 1023:
raise newException(FullStack, "Out of returnStack") raise newException(FullStack, "Out of returnStack")
c.returnStack.push returnPC c.returnStack.add returnPC
inc c.code.pc inc c.code.pc
# ########################################## # ##########################################

View File

@ -68,7 +68,7 @@ type
msg*: Message msg*: Message
memory*: Memory memory*: Memory
stack*: Stack stack*: Stack
returnStack*: Stack returnStack*: seq[int]
gasMeter*: GasMeter gasMeter*: GasMeter
code*: CodeStream code*: CodeStream
output*: seq[byte] output*: seq[byte]