Skip to content

Commit

Permalink
fix(tracer): fix value and gasUsed in root call (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwedge99 authored May 30, 2023
1 parent a8de51a commit 60b0e7f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions eth/tracers/sentio/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type sentioTracer struct {
currentGas math.HexOrDecimal64
callsNumber int
rootTrace Trace
gasLimit uint64
}

type TraceBase interface {
Expand Down Expand Up @@ -65,8 +66,14 @@ type Trace struct {
Traces []Trace `json:"traces,omitempty"`
}

func (t *sentioTracer) CaptureTxStart(gasLimit uint64) {}
func (t *sentioTracer) CaptureTxEnd(restGas uint64) {}
func (t *sentioTracer) CaptureTxStart(gasLimit uint64) {
t.gasLimit = gasLimit
}

func (t *sentioTracer) CaptureTxEnd(restGas uint64) {
t.rootTrace.GasUsed = math.HexOrDecimal64(t.gasLimit - restGas)
}

func (t *sentioTracer) CaptureStart(env vm.VMInterface, from libcommon.Address, to libcommon.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte) {
t.env = env
// Update list of precompiles based on current block
Expand All @@ -80,6 +87,7 @@ func (t *sentioTracer) CaptureStart(env vm.VMInterface, from libcommon.Address,
To: &to,
Gas: math.HexOrDecimal64(gas),
Input: input,
Value: value.Bytes(),
}
}
func (t *sentioTracer) CaptureEnd(output []byte, usedGas uint64, err error) {
Expand Down

0 comments on commit 60b0e7f

Please sign in to comment.