Skip to content

Commit

Permalink
Fix null ptr in debug_traceTransaction (#8593)
Browse files Browse the repository at this point in the history
Cherry pick #8585

---------

Co-authored-by: Somnath <[email protected]>
  • Loading branch information
yperbasis and somnathb1 authored Oct 26, 2023
1 parent 656c3d2 commit 0930daa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions eth/tracers/native/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,11 @@ func (t *callTracer) CaptureStart(env *vm.EVM, from libcommon.Address, to libcom
if create {
t.callstack[0].Type = vm.CREATE
}
t.logIndex = 0
t.logGaps = make(map[uint64]int)
}

// CaptureEnd is called after the call finishes to finalize the tracing.
func (t *callTracer) CaptureEnd(output []byte, gasUsed uint64, err error) {
t.callstack[0].processOutput(output, err)
t.logIndex = 0
t.logGaps = nil
}

// CaptureState implements the EVMLogger interface to trace a single step of VM execution.
Expand Down Expand Up @@ -241,8 +237,9 @@ func (t *callTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
}

func (t *callTracer) CaptureTxStart(gasLimit uint64) {

t.gasLimit = gasLimit
t.logIndex = 0
t.logGaps = make(map[uint64]int)
}

func (t *callTracer) CaptureTxEnd(restGas uint64) {
Expand All @@ -252,6 +249,8 @@ func (t *callTracer) CaptureTxEnd(restGas uint64) {
clearFailedLogs(&t.callstack[0], false, 0, t.logGaps)
fixLogIndexGap(&t.callstack[0], t.logGaps)
}
t.logIndex = 0
t.logGaps = nil
}

// GetResult returns the json-encoded nested list of call traces, and any
Expand Down Expand Up @@ -282,7 +281,7 @@ func clearFailedLogs(cf *callFrame, parentFailed bool, gap int, logGaps map[uint
gap += len(cf.Logs)
if gap > 0 {
lastIdx := len(cf.Logs) - 1
if lastIdx > 0 {
if lastIdx > 0 && logGaps != nil {
idx := cf.Logs[lastIdx].Index
logGaps[idx] = gap
}
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 53 // Minor version component of the current release
VersionMicro = 0 // Patch version component of the current release
VersionMicro = 1 // Patch version component of the current release
VersionModifier = "" // Modifier component of the current release
VersionKeyCreated = "ErigonVersionCreated"
VersionKeyFinished = "ErigonVersionFinished"
Expand Down

0 comments on commit 0930daa

Please sign in to comment.