fix block 668910 problem
This commit is contained in:
parent
d2b95c8191
commit
4cc318d948
|
@ -21,7 +21,6 @@ proc contractCall*(tx: Transaction, vmState: BaseVMState, sender: EthAddress, fo
|
||||||
return (tx.gasLimit - gasRemaining - gasRefund)
|
return (tx.gasLimit - gasRemaining - gasRefund)
|
||||||
else:
|
else:
|
||||||
if computation.tracingEnabled: computation.traceError()
|
if computation.tracingEnabled: computation.traceError()
|
||||||
vmState.clearLogs()
|
|
||||||
return tx.gasLimit
|
return tx.gasLimit
|
||||||
|
|
||||||
proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMState): GasInt =
|
proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMState): GasInt =
|
||||||
|
|
|
@ -276,6 +276,7 @@ proc addChildComputation(fork: Fork, computation: var BaseComputation, child: Ba
|
||||||
computation.returnData = child.output
|
computation.returnData = child.output
|
||||||
for k, v in child.accountsToDelete:
|
for k, v in child.accountsToDelete:
|
||||||
computation.accountsToDelete[k] = v
|
computation.accountsToDelete[k] = v
|
||||||
|
computation.logEntries.add child.logEntries
|
||||||
computation.children.add(child)
|
computation.children.add(child)
|
||||||
|
|
||||||
proc getFork*(computation: BaseComputation): Fork =
|
proc getFork*(computation: BaseComputation): Fork =
|
||||||
|
@ -302,7 +303,7 @@ proc isSuicided*(c: var BaseComputation, address: EthAddress): bool =
|
||||||
result = address in c.accountsToDelete
|
result = address in c.accountsToDelete
|
||||||
|
|
||||||
proc addLogEntry*(c: var BaseComputation, log: Log) {.inline.} =
|
proc addLogEntry*(c: var BaseComputation, log: Log) {.inline.} =
|
||||||
c.vmState.addLogEntry(log)
|
c.logEntries.add(log)
|
||||||
|
|
||||||
# many methods are basically TODO, but they still return valid values
|
# many methods are basically TODO, but they still return valid values
|
||||||
# in order to test some existing code
|
# in order to test some existing code
|
||||||
|
|
|
@ -163,17 +163,13 @@ proc getTracingResult*(vmState: BaseVMState): JsonNode =
|
||||||
assert(vmState.tracingEnabled)
|
assert(vmState.tracingEnabled)
|
||||||
vmState.tracer.trace
|
vmState.tracer.trace
|
||||||
|
|
||||||
proc addLogEntry*(vmState: BaseVMState, log: Log) =
|
proc addLogs*(vmState: BaseVMState, logs: seq[Log]) =
|
||||||
vmState.logEntries.add(log)
|
shallowCopy(vmState.logEntries, logs)
|
||||||
|
|
||||||
proc getAndClearLogEntries*(vmState: BaseVMState): seq[Log] =
|
proc getAndClearLogEntries*(vmState: BaseVMState): seq[Log] =
|
||||||
shallowCopy(result, vmState.logEntries)
|
shallowCopy(result, vmState.logEntries)
|
||||||
vmState.logEntries = @[]
|
vmState.logEntries = @[]
|
||||||
|
|
||||||
proc clearLogs*(vmState: BaseVMState) =
|
|
||||||
# call this when computation error
|
|
||||||
vmState.logEntries.setLen(0)
|
|
||||||
|
|
||||||
proc enableTracing*(vmState: BaseVMState) =
|
proc enableTracing*(vmState: BaseVMState) =
|
||||||
vmState.tracingEnabled = true
|
vmState.tracingEnabled = true
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ proc execComputation*(computation: var BaseComputation): bool =
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
snapshot.commit()
|
snapshot.commit()
|
||||||
|
computation.vmState.addLogs(computation.logEntries)
|
||||||
else:
|
else:
|
||||||
snapshot.revert()
|
snapshot.revert()
|
||||||
|
|
||||||
|
@ -126,7 +127,6 @@ proc applyCreateTransaction*(tx: Transaction, vmState: BaseVMState, sender: EthA
|
||||||
return (gasUsed + codeCost - gasRefund)
|
return (gasUsed + codeCost - gasRefund)
|
||||||
else:
|
else:
|
||||||
if c.tracingEnabled: c.traceError()
|
if c.tracingEnabled: c.traceError()
|
||||||
vmState.clearLogs()
|
|
||||||
return tx.gasLimit
|
return tx.gasLimit
|
||||||
|
|
||||||
#[
|
#[
|
||||||
|
|
|
@ -64,6 +64,7 @@ type
|
||||||
gasCosts*: GasCosts # TODO - will be hidden at a lower layer
|
gasCosts*: GasCosts # TODO - will be hidden at a lower layer
|
||||||
opCodeExec*: OpcodeExecutor
|
opCodeExec*: OpcodeExecutor
|
||||||
forkOverride*: Option[Fork]
|
forkOverride*: Option[Fork]
|
||||||
|
logEntries*: seq[Log]
|
||||||
|
|
||||||
Error* = ref object
|
Error* = ref object
|
||||||
info*: string
|
info*: string
|
||||||
|
|
Loading…
Reference in New Issue