Skip to content

Commit

Permalink
tweak: Use int milliseconds instead of string for duration.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-smith committed Sep 21, 2023
1 parent 70c76f7 commit 1c1036b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eth/tracers/blocknative/blocknative.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Trace struct {
CallFrame
BlockContext *BlockContext `json:"blockContext,omitempty"`
Logs []CallLog `json:"logs,omitempty"`
Time string `json:"time,omitempty"`
Time int64 `json:"time,omitempty"`
BalanceChanges decoder.NetBalanceChanges `json:"balanceChanges"`
}

Expand Down
4 changes: 1 addition & 3 deletions eth/tracers/blocknative/txnOpCodeTracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package blocknative

import (
"encoding/json"
"fmt"
"math/big"
"sync/atomic"
"time"
Expand Down Expand Up @@ -154,8 +153,7 @@ func (t *txnOpCodeTracer) CaptureEnd(output []byte, gasUsed uint64, err error) {
}

// Add total time duration for this trace request
elapsedTime := time.Now().Sub(t.startTime)
t.trace.Time = fmt.Sprintf("%v", elapsedTime)
t.trace.Time = time.Now().Sub(t.startTime).Nanoseconds()
}

// CaptureState implements the EVMLogger interface to trace a single step of VM execution.
Expand Down
4 changes: 2 additions & 2 deletions eth/tracers/internal/tracetest/txnOpCodeTracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ func (a BalanceChangesByAssetAddress) Less(i, j int) bool {

func tracesEqual(x, y *blocknative.Trace) bool {
// Clear out non-deterministic time
x.Time = ""
y.Time = ""
x.Time = 0
y.Time = 0

// Sort the balance changes because we don't care about the order of the
// breakdown.
Expand Down

0 comments on commit 1c1036b

Please sign in to comment.