Unverified Commit 73188580 authored by Felix Lange's avatar Felix Lange Committed by GitHub

eth/tracers/js: improve integer types in log object (#25668)

All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.
parent 4b9c307d
...@@ -256,11 +256,11 @@ func (t *jsTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope ...@@ -256,11 +256,11 @@ func (t *jsTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope
log.memory.memory = scope.Memory log.memory.memory = scope.Memory
log.stack.stack = scope.Stack log.stack.stack = scope.Stack
log.contract.contract = scope.Contract log.contract.contract = scope.Contract
log.pc = uint(pc) log.pc = pc
log.gas = uint(gas) log.gas = gas
log.cost = uint(cost) log.cost = cost
log.refund = uint(t.env.StateDB.GetRefund()) log.refund = t.env.StateDB.GetRefund()
log.depth = uint(depth) log.depth = depth
log.err = err log.err = err
if _, err := t.step(t.obj, t.logValue, t.dbValue); err != nil { if _, err := t.step(t.obj, t.logValue, t.dbValue); err != nil {
t.onError("step", err) t.onError("step", err)
...@@ -908,33 +908,19 @@ type steplog struct { ...@@ -908,33 +908,19 @@ type steplog struct {
stack *stackObj stack *stackObj
contract *contractObj contract *contractObj
pc uint pc uint64
gas uint gas uint64
cost uint cost uint64
depth uint depth int
refund uint refund uint64
err error err error
} }
func (l *steplog) GetPC() uint { func (l *steplog) GetPC() uint64 { return l.pc }
return l.pc func (l *steplog) GetGas() uint64 { return l.gas }
} func (l *steplog) GetCost() uint64 { return l.cost }
func (l *steplog) GetDepth() int { return l.depth }
func (l *steplog) GetGas() uint { func (l *steplog) GetRefund() uint64 { return l.refund }
return l.gas
}
func (l *steplog) GetCost() uint {
return l.cost
}
func (l *steplog) GetDepth() uint {
return l.depth
}
func (l *steplog) GetRefund() uint {
return l.refund
}
func (l *steplog) GetError() goja.Value { func (l *steplog) GetError() goja.Value {
if l.err != nil { if l.err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment