From ef3c4a1bed34451d06a595f19c746b0e99c19f70 Mon Sep 17 00:00:00 2001 From: Eric Le Ponner <91124272+ericleponner@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:07:36 +0100 Subject: [PATCH] 00765 Explorer should not report "Decoding Error" when error is empty in a contract result (#766) Signed-off-by: Eric Le Ponner --- src/utils/analyzer/FunctionCallAnalyzer.ts | 2 +- tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/analyzer/FunctionCallAnalyzer.ts b/src/utils/analyzer/FunctionCallAnalyzer.ts index 5f45f8575..fb7c287c0 100644 --- a/src/utils/analyzer/FunctionCallAnalyzer.ts +++ b/src/utils/analyzer/FunctionCallAnalyzer.ts @@ -224,7 +224,7 @@ export class FunctionCallAnalyzer { private readonly updateErrorDescription = async() => { const i = this.contractAnalyzer.interface.value const error = this.error.value - if (i !== null && error !== null) { + if (i !== null && error !== null && error !== "0x") { try { const ed = i.parseError(error) this.errorDescription.value = Object.preventExtensions(ed) diff --git a/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts b/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts index 564fe792f..f5947c80f 100644 --- a/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts +++ b/tests/unit/utils/analyzer/FunctionCallAnalyzer.spec.ts @@ -108,6 +108,7 @@ describe("FunctionCallAnalyzer.spec.ts", () => { // 5) output setup (invalid output encoding) input.value = "0x49146bde000000000000000000000000845b706151aed537b1fd81c1ea4ea03920097abd0000000000000000000000000000000000000000000000000000000002e6ae09" output.value = "0x000000009999999999999999999999999" + error.value = "0x" contractId.value = "0.0.359" await flushPromises() expect(functionCallAnalyzer.functionHash.value).toBe("0x49146bde") @@ -122,7 +123,7 @@ describe("FunctionCallAnalyzer.spec.ts", () => { expect(functionCallAnalyzer.errorInputs.value).toStrictEqual([]) expect(functionCallAnalyzer.inputDecodingStatus.value).toBeNull() expect(functionCallAnalyzer.outputDecodingStatus.value).toBe("Decoding Error (hex data is odd-length)") - expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() + expect(functionCallAnalyzer.errorDecodingStatus.value).toBeNull() // 0x is considered as no error // 6) unmount