Skip to content

Commit

Permalink
fix: debug_traceTransaction not working when we don't pass tracerConf…
Browse files Browse the repository at this point in the history
…ig (#2628)

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
  • Loading branch information
victor-yanev authored Jun 27, 2024
1 parent 8997ae2 commit d7e315d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

import { Relay, RelayImpl, JsonRpcError, predefined, MirrorNodeClientError } from '@hashgraph/json-rpc-relay';
import { JsonRpcError, MirrorNodeClientError, predefined, Relay, RelayImpl } from '@hashgraph/json-rpc-relay';
import { collectDefaultMetrics, Histogram, Registry } from 'prom-client';
import KoaJsonRpc from './koaJsonRpc';
import { TracerType, Validator } from './validator';
Expand Down Expand Up @@ -663,7 +663,14 @@ app.useRpc('eth_maxPriorityFeePerGas', async () => {
app.useRpc('debug_traceTransaction', async (params: any) => {
const transactionIdOrHash = params[0];
const { tracer, ...otherParams } = params[1];
const tracerConfig = tracer === TracerType.CallTracer ? otherParams.tracerConfig : otherParams;

let tracerConfig: object;
if (tracer === TracerType.CallTracer) {
tracerConfig = otherParams?.tracerConfig ?? { onlyTopCall: false };
} else {
tracerConfig = otherParams ?? { disableMemory: false, disableStack: false, disableStorage: false };
}

return logAndHandleResponse('debug_traceTransaction', [transactionIdOrHash, tracer, tracerConfig], (requestId) =>
relay.eth().debugService().debug_traceTransaction(transactionIdOrHash, tracer, tracerConfig, requestId),
);
Expand Down

0 comments on commit d7e315d

Please sign in to comment.