fix #245
This commit is contained in:
parent
750ea067d2
commit
0d64e0a6c3
|
@ -344,3 +344,6 @@ proc traceOpCodeEnded*(c: BaseComputation, op: Op, lastIndex: int) =
|
|||
|
||||
proc traceError*(c: BaseComputation) =
|
||||
c.vmState.tracer.traceError(c)
|
||||
|
||||
proc prepareTracer*(c: BaseComputation) =
|
||||
c.vmState.tracer.prepare(c.msg.depth)
|
||||
|
|
|
@ -228,6 +228,7 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
|
|||
|
||||
# Wrap the case statement in while true + computed goto
|
||||
result = quote do:
|
||||
`computation`.prepareTracer()
|
||||
var `instr` = `computation`.code.next()
|
||||
while true:
|
||||
{.computedGoto.}
|
||||
|
|
|
@ -24,13 +24,16 @@ proc initTracer*(tracer: var TransactionTracer, flags: set[TracerFlags] = {}) =
|
|||
tracer.accounts = initSet[EthAddress]()
|
||||
tracer.storageKeys = @[]
|
||||
|
||||
proc rememberStorageKey(tracer: var TransactionTracer, compDepth: int, key: Uint256) =
|
||||
proc prepare*(tracer: var TransactionTracer, compDepth: int) =
|
||||
if compDepth >= tracer.storageKeys.len:
|
||||
let prevLen = tracer.storageKeys.len
|
||||
tracer.storageKeys.setLen(compDepth + 1)
|
||||
for i in prevLen ..< tracer.storageKeys.len:
|
||||
for i in prevLen ..< tracer.storageKeys.len - 1:
|
||||
tracer.storageKeys[i] = initSet[Uint256]()
|
||||
|
||||
tracer.storageKeys[compDepth] = initSet[Uint256]()
|
||||
|
||||
proc rememberStorageKey(tracer: var TransactionTracer, compDepth: int, key: Uint256) =
|
||||
tracer.storageKeys[compDepth].incl key
|
||||
|
||||
iterator storage(tracer: TransactionTracer, compDepth: int): Uint256 =
|
||||
|
|
Loading…
Reference in New Issue