Skip to content

Commit

Permalink
fix default trace values for custom tracers (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclemos authored May 2, 2023
1 parent 631316f commit fe36528
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
32 changes: 21 additions & 11 deletions state/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,29 @@ func (s *State) DebugTransaction(ctx context.Context, transactionHash common.Has
traceConfigRequest := &pb.TraceConfig{
TxHashToGenerateCallTrace: transactionHash.Bytes(),
TxHashToGenerateExecuteTrace: transactionHash.Bytes(),
// set the defaults to the maximum information we can have.
// this is needed to process custom tracers later
DisableStorage: cFalse,
DisableStack: cFalse,
EnableMemory: cTrue,
EnableReturnData: cTrue,
}

if traceConfig.DisableStorage {
traceConfigRequest.DisableStorage = cTrue
}
if traceConfig.DisableStack {
traceConfigRequest.DisableStack = cTrue
}
if traceConfig.EnableMemory {
traceConfigRequest.EnableMemory = cTrue
}
if traceConfig.EnableReturnData {
traceConfigRequest.EnableReturnData = cTrue
// if the default tracer is used, then we review the information
// we want to have in the trace related to the parameters we received.
if traceConfig.IsDefaultTracer() {
if traceConfig.DisableStorage {
traceConfigRequest.DisableStorage = cTrue
}
if traceConfig.DisableStack {
traceConfigRequest.DisableStack = cTrue
}
if traceConfig.EnableMemory {
traceConfigRequest.EnableMemory = cTrue
}
if traceConfig.EnableReturnData {
traceConfigRequest.EnableReturnData = cTrue
}
}

oldStateRoot := previousBlock.Root()
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,11 +618,7 @@ func TestDebugTraceTransactionCallTracer(t *testing.T) {
}

debugOptions := map[string]interface{}{
"disableStorage": false,
"disableStack": false,
"enableMemory": true,
"enableReturnData": true,
"tracer": "callTracer",
"tracer": "callTracer",
"tracerConfig": map[string]interface{}{
"onlyTopCall": false,
"withLog": true,
Expand Down

0 comments on commit fe36528

Please sign in to comment.