@matterlabs/hardhat-zksync-solc
Advanced tools
Comparing version 0.3.10 to 0.3.11-beta.1
@@ -8,4 +8,5 @@ "use strict"; | ||
const compilerPath = config.settings.compilerPath || await (0, utils_1.getZksolcPath)(config.version); | ||
const isSystem = config.settings.isSystem; | ||
const output = await new Promise((resolve, reject) => { | ||
const process = (0, child_process_1.exec)(`${compilerPath} --standard-json --solc ${solcPath}`, { | ||
const process = (0, child_process_1.exec)(`${compilerPath} --standard-json ${isSystem ? '--system-mode' : ''} --solc ${solcPath}`, { | ||
maxBuffer: 1024 * 1024 * 500, | ||
@@ -12,0 +13,0 @@ }, (err, stdout, _stderr) => { |
import { HardhatDocker, Image } from '@nomiclabs/hardhat-docker'; | ||
import { CompilerInput } from 'hardhat/types'; | ||
import { ZkSolcConfig } from '../types'; | ||
export declare function dockerImage(imageName?: string, imageTag?: string): Image; | ||
@@ -7,4 +8,4 @@ export declare function validateDockerIsInstalled(): Promise<void>; | ||
export declare function pullImageIfNecessary(docker: HardhatDocker, image: Image): Promise<void>; | ||
export declare function compileWithDocker(input: CompilerInput, docker: HardhatDocker, image: Image): Promise<any>; | ||
export declare function compileWithDocker(input: CompilerInput, docker: HardhatDocker, image: Image, zksolcConfig: ZkSolcConfig): Promise<any>; | ||
export declare function getSolcVersion(docker: HardhatDocker, image: Image): Promise<string>; | ||
//# sourceMappingURL=docker.d.ts.map |
@@ -94,7 +94,11 @@ "use strict"; | ||
} | ||
async function compileWithDocker(input, docker, image) { | ||
async function compileWithDocker(input, docker, image, zksolcConfig) { | ||
const command = ['zksolc', '--standard-json']; | ||
if (zksolcConfig.settings.isSystem) { | ||
command.push('--system-mode'); | ||
} | ||
// @ts-ignore | ||
const dockerInstance = docker._docker; | ||
return await handleCommonErrors((async () => { | ||
const compilerOutput = await runContainer(dockerInstance, image, ['zksolc', '--standard-json'], JSON.stringify(input)); | ||
const compilerOutput = await runContainer(dockerInstance, image, command, JSON.stringify(input)); | ||
try { | ||
@@ -101,0 +105,0 @@ return JSON.parse(compilerOutput); |
@@ -18,3 +18,3 @@ import { ZkSolcConfig } from '../types'; | ||
static initialize(config: ZkSolcConfig): Promise<DockerCompiler>; | ||
compile(input: CompilerInput, _config: ZkSolcConfig): Promise<any>; | ||
compile(input: CompilerInput, config: ZkSolcConfig): Promise<any>; | ||
solcVersion(): Promise<{ | ||
@@ -21,0 +21,0 @@ version: string; |
@@ -46,4 +46,4 @@ "use strict"; | ||
} | ||
async compile(input, _config) { | ||
return await (0, docker_1.compileWithDocker)(input, this.docker, this.dockerImage); | ||
async compile(input, config) { | ||
return await (0, docker_1.compileWithDocker)(input, this.docker, this.dockerImage, config); | ||
} | ||
@@ -50,0 +50,0 @@ async solcVersion() { |
@@ -22,2 +22,3 @@ import { Artifact } from 'hardhat/types'; | ||
}; | ||
isSystem?: boolean; | ||
}; | ||
@@ -24,0 +25,0 @@ } |
{ | ||
"name": "@matterlabs/hardhat-zksync-solc", | ||
"version": "0.3.10", | ||
"version": "0.3.11-beta.1", | ||
"description": "Hardhat plugin to compile smart contracts for the zkSync network", | ||
@@ -51,3 +51,3 @@ "repository": "github:matter-labs/hardhat-zksync", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"hardhat": "^2.11.1", | ||
"hardhat": "^2.12.1", | ||
"mocha": "^9.2.1", | ||
@@ -60,3 +60,3 @@ "prettier": "2.5.1", | ||
"peerDependencies": { | ||
"hardhat": "^2.11.1" | ||
"hardhat": "^2.12.1" | ||
}, | ||
@@ -63,0 +63,0 @@ "prettier": { |
@@ -7,5 +7,6 @@ import { exec } from 'child_process'; | ||
const compilerPath = config.settings.compilerPath || await getZksolcPath(config.version); | ||
const isSystem = config.settings.isSystem; | ||
const output: string = await new Promise((resolve, reject) => { | ||
const process = exec( | ||
`${compilerPath} --standard-json --solc ${solcPath}`, | ||
`${compilerPath} --standard-json ${isSystem ? '--system-mode' : ''} --solc ${solcPath}`, | ||
{ | ||
@@ -12,0 +13,0 @@ maxBuffer: 1024 * 1024 * 500, |
@@ -14,2 +14,3 @@ import { | ||
import { Writable } from 'stream'; | ||
import { ZkSolcConfig } from '../types'; | ||
@@ -121,3 +122,9 @@ async function runContainer(docker: Docker, image: Image, command: string[], input: string) { | ||
image: Image, | ||
zksolcConfig: ZkSolcConfig | ||
) { | ||
const command = ['zksolc', '--standard-json']; | ||
if(zksolcConfig.settings.isSystem) { | ||
command.push('--system-mode'); | ||
} | ||
// @ts-ignore | ||
@@ -129,3 +136,3 @@ const dockerInstance: Docker = docker._docker; | ||
image, | ||
['zksolc', '--standard-json'], | ||
command, | ||
JSON.stringify(input) | ||
@@ -132,0 +139,0 @@ ); |
@@ -56,4 +56,4 @@ import { ZkSolcConfig } from '../types'; | ||
public async compile(input: CompilerInput, _config: ZkSolcConfig) { | ||
return await compileWithDocker(input, this.docker, this.dockerImage); | ||
public async compile(input: CompilerInput, config: ZkSolcConfig) { | ||
return await compileWithDocker(input, this.docker, this.dockerImage, config); | ||
} | ||
@@ -60,0 +60,0 @@ |
@@ -26,2 +26,4 @@ import { Artifact } from 'hardhat/types'; | ||
}; | ||
// Whether to support compilation of zkSync-specific simulations | ||
isSystem?: boolean | ||
}; | ||
@@ -28,0 +30,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60525
999