From 40fe149e7ddc0afc9157a90204e4ea977b96277c Mon Sep 17 00:00:00 2001 From: sealer3 <125761775+sealer3@users.noreply.github.com> Date: Wed, 12 Jul 2023 08:14:31 +0000 Subject: [PATCH] Catch auxdata decode error when checking for perfect match --- packages/lib-sourcify/src/lib/CheckedContract.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/lib-sourcify/src/lib/CheckedContract.ts b/packages/lib-sourcify/src/lib/CheckedContract.ts index a0ded8143..00e9ce7d7 100644 --- a/packages/lib-sourcify/src/lib/CheckedContract.ts +++ b/packages/lib-sourcify/src/lib/CheckedContract.ts @@ -114,7 +114,13 @@ export class CheckedContract { async tryToFindPerfectMetadata( deployedBytecode: string ): Promise { - const decodedAuxdata = decodeBytecode(deployedBytecode); + let decodedAuxdata; + try { + decodedAuxdata = decodeBytecode(deployedBytecode); + } catch (err) { + // There is no auxdata at all in this contract + return null; + } const pathContent: PathContent[] = Object.keys(this.solidity).map( (path) => {