Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing setting properties to support isSystem and forceEvml… #965

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 10 additions & 2 deletions packages/hardhat-zksync-verify/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ Instead, this name was received: ${contractFQN}`,
}
}

export function getSolidityStandardJsonInput(resolvedFiles: ResolvedFile[], input: CompilerInput): any {
export function getSolidityStandardJsonInput(
hre: HardhatRuntimeEnvironment,
resolvedFiles: ResolvedFile[],
input: CompilerInput,
): any {
return {
language: input.language,
sources: Object.fromEntries(
resolvedFiles.map((file) => [file.sourceName, { content: file.content.rawContent }]),
),
settings: input.settings,
settings: {
...input.settings,
isSystem: hre.config.zksolc.settings.isSystem ?? false,
forceEvmla: hre.config.zksolc.settings.forceEvmla ?? false,
},
};
}

Expand Down
6 changes: 5 additions & 1 deletion packages/hardhat-zksync-verify/src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ export async function verifyContract(

const request = {
contractAddress: address,
sourceCode: getSolidityStandardJsonInput(dependencyGraph.getResolvedFiles(), contractInformation.compilerInput),
sourceCode: getSolidityStandardJsonInput(
hre,
dependencyGraph.getResolvedFiles(),
contractInformation.compilerInput,
),
codeFormat: JSON_INPUT_CODE_FORMAT,
contractName: contractInformation.contractName,
compilerSolcVersion: solcVersion,
Expand Down
14 changes: 13 additions & 1 deletion packages/hardhat-zksync-verify/test/tests/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ Instead, this name was received: ${contractFQN}`);
describe('getSolidityStandardJsonInput', async function () {
useEnvironment('localGreeter');
it('should return the Solidity standard JSON input', async function () {
const hre = {
config: {
zksolc: {
settings: {
isSystem: true,
},
},
},
};

const resolvedFiles: ResolvedFile[] = [
{
sourceName: 'contracts/Contract.sol',
Expand All @@ -254,7 +264,7 @@ Instead, this name was received: ${contractFQN}`);
},
];

const solidityStandardJsonInput = getSolidityStandardJsonInput(resolvedFiles, {
const solidityStandardJsonInput = getSolidityStandardJsonInput(hre as any, resolvedFiles, {
language: 'Solidity',
sources: {
'contracts/Contract.sol': {
Expand All @@ -278,6 +288,8 @@ Instead, this name was received: ${contractFQN}`);
'contract Contract {}',
);
expect(solidityStandardJsonInput.settings.optimizer.enabled).to.equal(true);
expect(solidityStandardJsonInput.settings.isSystem).to.equal(true);
expect(solidityStandardJsonInput.settings.forceEvmla).to.equal(false);
});
});

Expand Down
Loading