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

fix default trace values for custom tracers #2066

Merged
merged 1 commit into from
May 2, 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
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