Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Ensure CalldataDecodingInspector always passes through inspector options #6136

Merged
merged 1 commit into from
Jul 7, 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
48 changes: 34 additions & 14 deletions packages/codec/lib/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,15 @@ export class CalldataDecodingInspector {
return formatMulticall(
fullName,
this.decoding.interpretations.multicall,
options
options,
this.options
);
} else if (this.decoding.interpretations.aggregate) {
return formatAggregate(
fullName,
this.decoding.interpretations.aggregate,
options
options,
this.options
);
} else if (this.decoding.interpretations.tryAggregate) {
const { requireSuccess, calls } =
Expand All @@ -327,6 +329,7 @@ export class CalldataDecodingInspector {
fullName,
calls,
options,
this.options,
"requireSuccess",
options.stylize(requireSuccess.toString(), "number")
);
Expand All @@ -337,6 +340,7 @@ export class CalldataDecodingInspector {
fullName,
decodings,
options,
this.options,
"deadline",
options.stylize(deadline.toString(), "number")
);
Expand All @@ -347,16 +351,23 @@ export class CalldataDecodingInspector {
fullName,
decodings,
options,
this.options,
"previousBlockhash",
options.stylize(specifiedBlockhash, "number")
);
}
return formatFunctionLike(fullName, this.decoding.arguments, options);
return formatFunctionLike(
fullName,
this.decoding.arguments,
options,
this.options
);
case "constructor":
return formatFunctionLike(
`new ${this.decoding.class.typeName}`,
this.decoding.arguments,
options
options,
this.options
);
case "message":
const { data, abi } = this.decoding;
Expand All @@ -377,6 +388,7 @@ export class CalldataDecodingInspector {
`${this.decoding.class.typeName}.${abi.type}`,
[{ value: codecValue }],
options,
this.options,
true // we don't need to see the type here!
);
} else {
Expand Down Expand Up @@ -461,12 +473,18 @@ export class LogDecodingInspector {
}
switch (this.decoding.kind) {
case "event":
return formatFunctionLike(fullName, this.decoding.arguments, options);
return formatFunctionLike(
fullName,
this.decoding.arguments,
options,
this.options
);
case "anonymous":
return formatFunctionLike(
`<anonymous> ${fullName}`,
this.decoding.arguments,
options
options,
this.options
);
}
}
Expand Down Expand Up @@ -496,7 +514,8 @@ export class ReturndataDecodingInspector {
return formatFunctionLike(
"Returned values: ",
this.decoding.arguments,
options
options,
this.options
);
case "returnmessage":
const { data } = this.decoding;
Expand Down Expand Up @@ -528,7 +547,8 @@ export class ReturndataDecodingInspector {
return formatFunctionLike(
`Error thrown:${OS.EOL}${name}`,
this.decoding.arguments,
options
options,
this.options
);
case "bytecode":
//this one gets custom handling :P
Expand Down Expand Up @@ -601,9 +621,9 @@ export function formatFunctionLike(
header: string,
values: AbiArgument[],
options: InspectOptions,
inspectorOptions?: ResultInspectorOptions,
suppressType: boolean = false,
indent: number = 2, //for use by debug-utils
inspectorOptions?: ResultInspectorOptions
indent: number = 2 //for use by debug-utils
): string {
if (values.length === 0) {
return `${header}()`;
Expand Down Expand Up @@ -637,9 +657,9 @@ function formatMulticall(
fullName: string,
decodings: (CalldataDecoding | null)[],
options: InspectOptions,
inspectorOptions?: ResultInspectorOptions,
additionalParameterName?: string,
additionalParameterValue?: string,
inspectorOptions?: ResultInspectorOptions
additionalParameterValue?: string
): string {
if (decodings.length === 0) {
return `${fullName}()`;
Expand Down Expand Up @@ -670,9 +690,9 @@ function formatAggregate(
fullName: string,
calls: CallInterpretationInfo[],
options: InspectOptions,
inspectorOptions?: ResultInspectorOptions,
additionalParameterName?: string,
additionalParameterValue?: string,
inspectorOptions?: ResultInspectorOptions
additionalParameterValue?: string
): string {
if (calls.length === 0) {
return `${fullName}()`;
Expand Down
1 change: 1 addition & 0 deletions packages/debug-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ var DebugUtils = {
name,
decoding.arguments,
inspectOptions,
{ noHideAddress: true },
false,
indent
);
Expand Down