Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak: Use int nanoseconds instead of string for duration. #121

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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