Skip to content

Commit

Permalink
Merge pull request #1022 from ethereum/throw-empty-recompiled-bytecode
Browse files Browse the repository at this point in the history
Throw before if compiled bytecode empty instead of later in creation bytecode
  • Loading branch information
marcocastignoli authored May 9, 2023
2 parents dceda9f + 71acbeb commit 765215b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/lib-sourcify/src/lib/verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export async function verifyDeployed(
};
const recompiled = await checkedContract.recompile();

if (
recompiled.deployedBytecode === '0x' ||
recompiled.creationBytecode === '0x'
) {
throw new Error(
`The compiled contract bytecode is "0x". Are you trying to verify an abstract contract?`
);
}

const deployedBytecode = await getBytecode(sourcifyChain, address);

// Can't match if there is no deployed bytecode
Expand Down Expand Up @@ -369,6 +378,7 @@ export async function matchWithCreationTx(
match.message = `Failed to match with creation bytecode: recompiled contract's creation bytecode is empty`;
return;
}

const creatorTx = await getTx(creatorTxHash, sourcifyChain);
const creatorTxData = creatorTx.input;

Expand Down

0 comments on commit 765215b

Please sign in to comment.