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) =
|
proc traceError*(c: BaseComputation) =
|
||||||
c.vmState.tracer.traceError(c)
|
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
|
# Wrap the case statement in while true + computed goto
|
||||||
result = quote do:
|
result = quote do:
|
||||||
|
`computation`.prepareTracer()
|
||||||
var `instr` = `computation`.code.next()
|
var `instr` = `computation`.code.next()
|
||||||
while true:
|
while true:
|
||||||
{.computedGoto.}
|
{.computedGoto.}
|
||||||
|
|
|
@ -24,13 +24,16 @@ proc initTracer*(tracer: var TransactionTracer, flags: set[TracerFlags] = {}) =
|
||||||
tracer.accounts = initSet[EthAddress]()
|
tracer.accounts = initSet[EthAddress]()
|
||||||
tracer.storageKeys = @[]
|
tracer.storageKeys = @[]
|
||||||
|
|
||||||
proc rememberStorageKey(tracer: var TransactionTracer, compDepth: int, key: Uint256) =
|
proc prepare*(tracer: var TransactionTracer, compDepth: int) =
|
||||||
if compDepth >= tracer.storageKeys.len:
|
if compDepth >= tracer.storageKeys.len:
|
||||||
let prevLen = tracer.storageKeys.len
|
let prevLen = tracer.storageKeys.len
|
||||||
tracer.storageKeys.setLen(compDepth + 1)
|
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[i] = initSet[Uint256]()
|
||||||
|
|
||||||
|
tracer.storageKeys[compDepth] = initSet[Uint256]()
|
||||||
|
|
||||||
|
proc rememberStorageKey(tracer: var TransactionTracer, compDepth: int, key: Uint256) =
|
||||||
tracer.storageKeys[compDepth].incl key
|
tracer.storageKeys[compDepth].incl key
|
||||||
|
|
||||||
iterator storage(tracer: TransactionTracer, compDepth: int): Uint256 =
|
iterator storage(tracer: TransactionTracer, compDepth: int): Uint256 =
|
||||||
|
|
Loading…
Reference in New Issue