Skip to content
Open
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
2 changes: 1 addition & 1 deletion scripts/hardhat/verifyOnChainBytecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export async function verifyOnChainBytecode(
}: TaskArguments,
hre: HardhatRuntimeEnvironment
): Promise<BytecodeComparisonResult[]> {
if (optimizerRuns) {
if (optimizerRuns !== undefined) {
validateOptimizerRuns(optimizerRuns);
execSyncWrapper(`forge build --optimizer-runs ${optimizerRuns}`);
}
Expand Down
23 changes: 23 additions & 0 deletions test/scripts/hardhat/verifyOnChainBytecode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,29 @@ describe("Verify on chain bytecode", () => {
).to.be.true;
});

it("will execute the expected forge command when optimizerRuns is zero", async () => {
const results = await verifyOnChainBytecode(
{
contractName: "FiatTokenProxy",
contractAddress: await opMainnetArtifactFiatTokenProxy.getAddress(),
verificationType: BytecodeVerificationType.Partial,
artifactType: ArtifactType.OPMainnet,
optimizerRuns: 0,
},
hre
);

expect(results).to.deep.equal([
{ type: BytecodeInputType.RuntimeBytecodePartial, equal: true },
]);

expect(
execSyncWrapperStub.calledOnceWithExactly(
"forge build --optimizer-runs 0"
)
).to.be.true;
});

it("Can detect mismatched metadata input", async () => {
const results = await verifyOnChainBytecode(
{
Expand Down