Skip to content

Commit

Permalink
eth/tracers: make 4byte tracer not care about create
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Nov 11, 2021
1 parent a276328 commit d57724b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion eth/tracers/js/internal/tracers/4byte_tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@
this.ids[key] = this.ids[key] + 1 || 1;
},

enter: function(frame) {
enter: function(frame, log) {
// Skip any pre-compile invocations, those are just fancy opcodes
if (isPrecompiled(frame.getTo())) {
return;
}
var type = frame.getType()
if (type !== "CALL" && type !== "STATICCALL" &&
type !== "DELEGATECALL" && type !== "CALLCODE"){
return;
}
var input = frame.getInput()
if (input.length >= 4) {
this.store(slice(input, 0, 4), input.length - 4);
Expand Down
6 changes: 3 additions & 3 deletions eth/tracers/js/internal/tracers/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion eth/tracers/native/4byte.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (t *fourByteTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64,
}

// CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct).
func (t *fourByteTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
func (t *fourByteTracer) CaptureEnter(op vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
// Skip if tracing was interrupted
if atomic.LoadUint32(&t.interrupt) > 0 {
t.env.Cancel()
Expand All @@ -106,6 +106,11 @@ func (t *fourByteTracer) CaptureEnter(typ vm.OpCode, from common.Address, to com
if len(input) < 4 {
return
}
// primarily we want to avoid CREATE/CREATE2/SELFDESTRUCT
if op != vm.DELEGATECALL && op != vm.STATICCALL &&
op != vm.CALL && op != vm.CALLCODE {
return
}
// Skip any pre-compile invocations, those are just fancy opcodes
if t.isPrecompiled(to) {
return
Expand Down

0 comments on commit d57724b

Please sign in to comment.