Skip to content

Commit 5d83648

Browse files
committed
fix: fixed param arrangement
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
1 parent 295686b commit 5d83648

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

packages/relay/src/lib/debug.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { MirrorNodeClient } from './clients';
99
import { IOpcode } from './clients/models/IOpcode';
1010
import { IOpcodesResponse } from './clients/models/IOpcodesResponse';
1111
import constants, { CallType, TracerType } from './constants';
12-
import { rpcMethod, rpcParamValidationRules } from './decorators';
12+
import { RPC_LAYOUT, rpcMethod, rpcParamLayoutConfig, rpcParamValidationRules } from './decorators';
1313
import { predefined } from './errors/JsonRpcError';
1414
import { CommonService } from './services';
1515
import { CacheService } from './services/cacheService/cacheService';
@@ -148,6 +148,7 @@ export class DebugImpl implements Debug {
148148
0: { type: ParamType.BLOCK_NUMBER, required: true },
149149
1: { type: ParamType.TRACER_CONFIG_WRAPPER, required: false },
150150
})
151+
@rpcParamLayoutConfig(RPC_LAYOUT.custom((params) => [Number(params[0]), params[1]]))
151152
async traceBlockByNumber(
152153
blockNumber: string,
153154
tracerObject: IBlockTracerConfig,
@@ -194,8 +195,13 @@ export class DebugImpl implements Debug {
194195
return [];
195196
}
196197

197-
const { tracer, tracerConfig, onlyTopCall } = tracerObject;
198-
const onlyTopCallOption = tracerConfig?.onlyTopCall || onlyTopCall;
198+
let tracer = TracerType.CallTracer;
199+
let onlyTopCall;
200+
201+
if (tracerObject) {
202+
tracer = tracerObject.tracer;
203+
onlyTopCall = tracerObject.tracerConfig?.onlyTopCall;
204+
}
199205

200206
if (tracer === TracerType.CallTracer) {
201207
const result = await Promise.all(
@@ -207,7 +213,7 @@ export class DebugImpl implements Debug {
207213
txHash: contractResult.hash,
208214
result: await this.callTracer(
209215
contractResult.hash,
210-
{ onlyTopCallOption } as ICallTracerConfig,
216+
{ onlyTopCall } as ICallTracerConfig,
211217
requestDetails,
212218
),
213219
};
@@ -226,7 +232,7 @@ export class DebugImpl implements Debug {
226232
.map(async (contractResult) => {
227233
return {
228234
txHash: contractResult.hash,
229-
result: await this.prestateTracer(contractResult.hash, onlyTopCallOption, requestDetails),
235+
result: await this.prestateTracer(contractResult.hash, onlyTopCall, requestDetails),
230236
};
231237
}),
232238
);

packages/relay/src/lib/types/ITracerConfigWrapper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ export interface ITracerConfigWrapper {
1111
export interface IBlockTracerConfig {
1212
tracer: TracerType;
1313
tracerConfig?: ICallTracerConfig;
14-
onlyTopCall?: boolean;
1514
}

0 commit comments

Comments
 (0)