rename binary to resolc

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2024-05-08 11:16:24 +02:00
parent e958da5cd1
commit 6f080bb9f4
16 changed files with 43 additions and 65 deletions
+4 -4
View File
@@ -43,7 +43,7 @@ impl Build {
pub fn write_to_combined_json(
self,
combined_json: &mut CombinedJson,
zksolc_version: &semver::Version,
resolc_version: &semver::Version,
) -> anyhow::Result<()> {
for (path, contract) in self.contracts.into_iter() {
let combined_json_contract = combined_json
@@ -61,7 +61,7 @@ impl Build {
contract.write_to_combined_json(combined_json_contract)?;
}
combined_json.zk_version = Some(zksolc_version.to_string());
combined_json.zk_version = Some(resolc_version.to_string());
Ok(())
}
@@ -71,7 +71,7 @@ impl Build {
mut self,
standard_json: &mut StandardJsonOutput,
solc_version: &SolcVersion,
zksolc_version: &semver::Version,
resolc_version: &semver::Version,
) -> anyhow::Result<()> {
let contracts = match standard_json.contracts.as_mut() {
Some(contracts) => contracts,
@@ -90,7 +90,7 @@ impl Build {
standard_json.version = Some(solc_version.default.to_string());
standard_json.long_version = Some(solc_version.long.to_owned());
standard_json.zk_version = Some(zksolc_version.to_string());
standard_json.zk_version = Some(resolc_version.to_string());
Ok(())
}
+1 -1
View File
@@ -3,7 +3,7 @@
#![allow(dead_code)]
/// The default executable name.
pub static DEFAULT_EXECUTABLE_NAME: &str = "zksolc";
pub static DEFAULT_EXECUTABLE_NAME: &str = "resolc";
/// The `keccak256` scratch space offset.
pub const OFFSET_SCRATCH_SPACE: usize = 0;
+5 -5
View File
@@ -225,7 +225,7 @@ pub fn standard_json(
) -> anyhow::Result<()> {
let solc_version = solc.version()?;
let solc_pipeline = SolcPipeline::new(&solc_version, force_evmla);
let zksolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid");
let resolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid");
let solc_input = SolcStandardJsonInput::try_from_stdin(solc_pipeline)?;
let source_code_files = solc_input
@@ -275,7 +275,7 @@ pub fn standard_json(
missing_libraries.write_to_standard_json(
&mut solc_output,
&solc_version,
&zksolc_version,
&resolc_version,
)?;
} else {
let build = project.compile(
@@ -285,7 +285,7 @@ pub fn standard_json(
false,
debug_config,
)?;
build.write_to_standard_json(&mut solc_output, &solc_version, &zksolc_version)?;
build.write_to_standard_json(&mut solc_output, &solc_version, &resolc_version)?;
}
serde_json::to_writer(std::io::stdout(), &solc_output)?;
std::process::exit(0);
@@ -313,7 +313,7 @@ pub fn combined_json(
output_directory: Option<PathBuf>,
overwrite: bool,
) -> anyhow::Result<()> {
let zksolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid");
let resolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid");
let build = standard_output(
input_files,
@@ -334,7 +334,7 @@ pub fn combined_json(
)?;
let mut combined_json = solc.combined_json(input_files, format.as_str())?;
build.write_to_combined_json(&mut combined_json, &zksolc_version)?;
build.write_to_combined_json(&mut combined_json, &resolc_version)?;
match output_directory {
Some(output_directory) => {
+2 -2
View File
@@ -23,7 +23,7 @@ impl MissingLibraries {
mut self,
standard_json: &mut StandardJsonOutput,
solc_version: &SolcVersion,
zksolc_version: &semver::Version,
resolc_version: &semver::Version,
) -> anyhow::Result<()> {
let contracts = match standard_json.contracts.as_mut() {
Some(contracts) => contracts,
@@ -43,7 +43,7 @@ impl MissingLibraries {
standard_json.version = Some(solc_version.default.to_string());
standard_json.long_version = Some(solc_version.long.to_owned());
standard_json.zk_version = Some(zksolc_version.to_string());
standard_json.zk_version = Some(resolc_version.to_string());
Ok(())
}
@@ -11,7 +11,7 @@ use structopt::StructOpt;
/// are given or "-" is specified as a file name). Outputs the components based on the
/// chosen options, either to the standard output or to files within the designated
/// output directory.
/// Example: zksolc ERC20.sol -O3 --bin --output-dir './build/'
/// Example: resolc ERC20.sol -O3 --bin --output-dir './build/'
#[derive(Debug, StructOpt)]
#[structopt(name = "The PolkaVM Solidity compiler")]
pub struct Arguments {
@@ -69,13 +69,13 @@ pub struct Arguments {
pub disable_solc_optimizer: bool,
/// Specify the path to the `solc` executable. By default, the one in `${PATH}` is used.
/// Yul mode: `solc` is used for source code validation, as `zksolc` itself assumes that the input Yul is valid.
/// Yul mode: `solc` is used for source code validation, as `resolc` itself assumes that the input Yul is valid.
/// LLVM IR mode: `solc` is unused.
#[structopt(long = "solc")]
pub solc: Option<String>,
/// The EVM target version to generate IR for.
/// See https://github.com/matter-labs/era-compiler-common/blob/main/src/evm_version.rs for reference.
/// See https://github.com/xermicus/revive/blob/main/crates/common/src/evm_version.rs for reference.
#[structopt(long = "evm-version")]
pub evm_version: Option<String>,
@@ -26,7 +26,7 @@ pub struct CombinedJson {
pub sources: Option<serde_json::Value>,
/// The `solc` compiler version.
pub version: String,
/// The `zksolc` compiler version.
/// The `resolc` compiler version.
#[serde(skip_serializing_if = "Option::is_none")]
pub zk_version: Option<String>,
}
@@ -43,7 +43,7 @@ pub struct Output {
/// The `solc` compiler long version.
#[serde(skip_serializing_if = "Option::is_none")]
pub long_version: Option<String>,
/// The `zksolc` compiler version.
/// The `resolc` compiler version.
#[serde(skip_serializing_if = "Option::is_none")]
pub zk_version: Option<String>,
}
@@ -1,9 +1,9 @@
{
"name": "cli-tests",
"version": "1.0.0",
"title": "zksolc CLI Tests",
"description": "Auto tests for verifying zksolc CLI",
"repository": "https://github.com/matter-labs/era_compiler-solidity",
"title": "resolc CLI Tests",
"description": "Auto tests for verifying resolc CLI",
"repository": "https://github.com/xermicus/revive",
"main": "index.js",
"private": true,
"scripts": {
@@ -11,6 +11,9 @@
},
"keywords": [],
"author": "Matter Labs",
"contributors": [
"cyrill@parity.io"
],
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.11",
@@ -4,9 +4,9 @@ import { paths } from '../src/entities';
//id1746
describe("Run with --asm by default", () => {
const command = `zksolc ${paths.pathToBasicSolContract} --asm`;
const command = `resolc ${paths.pathToBasicSolContract} --asm`;
const result = executeCommand(command);
const commandInvalid = 'zksolc --asm';
const commandInvalid = 'resolc --asm';
const resultInvalid = executeCommand(commandInvalid);
it("Valid command exit code = 0", () => {
@@ -21,13 +21,13 @@ describe("Run with --asm by default", () => {
}
});
it("solc exit code == zksolc exit code", () => {
it("solc exit code == resolc exit code", () => {
const command = `solc ${paths.pathToBasicSolContract} --asm`;
const solcResult = executeCommand(command);
expect(solcResult.exitCode).toBe(result.exitCode);
});
it("run invalid: zksolc --asm", () => {
it("run invalid: resolc --asm", () => {
expect(resultInvalid.output).toMatch(/(No input sources specified|Compilation aborted)/i);
});
@@ -35,7 +35,7 @@ describe("Run with --asm by default", () => {
expect(resultInvalid.exitCode).toBe(1);
});
it("Invalid solc exit code == Invalid zksolc exit code", () => {
it("Invalid solc exit code == Invalid resolc exit code", () => {
const command = 'solc --asm';
const solcResult = executeCommand(command);
expect(solcResult.exitCode).toBe(resultInvalid.exitCode);
@@ -3,8 +3,8 @@ import { paths } from '../src/entities';
//id1762
describe("Run zksolc without any options", () => {
const command = 'zksolc';
describe("Run resolc without any options", () => {
const command = 'resolc';
const result = executeCommand(command);
it("Info with help is presented", () => {
@@ -15,7 +15,7 @@ describe("Run zksolc without any options", () => {
expect(result.exitCode).toBe(1);
});
it("solc exit code == zksolc exit code", () => {
it("solc exit code == resolc exit code", () => {
const command = 'solc';
const solcResult = executeCommand(command);
expect(solcResult.exitCode).toBe(result.exitCode);
@@ -26,7 +26,7 @@ describe("Run zksolc without any options", () => {
//#1713
describe("Default run a command from the help", () => {
const command = `zksolc ${paths.pathToBasicSolContract} -O3 --bin --output-dir "${paths.pathToOutputDir}"`; // potential issue on zksolc with full path on Windows cmd
const command = `resolc ${paths.pathToBasicSolContract} -O3 --bin --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd
const result = executeCommand(command);
it("Compiler run successful", () => {
@@ -52,7 +52,7 @@ describe("Default run a command from the help", () => {
//#1818
describe("Default run a command from the help", () => {
const command = `zksolc ${paths.pathToBasicSolContract} -O3 --bin --asm --output-dir "${paths.pathToOutputDir}"`; // potential issue on zksolc with full path on Windows cmd
const command = `resolc ${paths.pathToBasicSolContract} -O3 --bin --asm --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd
const result = executeCommand(command);
it("Compiler run successful", () => {
@@ -4,9 +4,9 @@ import { paths } from '../src/entities';
//id1743
describe("Run with --yul by default", () => {
const command = `zksolc ${paths.pathToBasicYulContract} --yul`;
const command = `resolc ${paths.pathToBasicYulContract} --yul`;
const result = executeCommand(command);
const commandInvalid = 'zksolc --yul';
const commandInvalid = 'resolc --yul';
const resultInvalid = executeCommand(commandInvalid);
it("Valid command exit code = 0", () => {
@@ -19,20 +19,20 @@ describe("Run with --yul by default", () => {
});
xit("solc exit code == zksolc exit code", () => { // unknown solc issue for datatype of the contract
xit("solc exit code == resolc exit code", () => { // unknown solc issue for datatype of the contract
const command = `solc ${paths.pathToBasicSolContract} --yul`;
const solcResult = executeCommand(command);
expect(solcResult.exitCode).toBe(result.exitCode);
});
it("run invalid: zksolc --yul", () => {
it("run invalid: resolc --yul", () => {
expect(resultInvalid.output).toMatch(/(The input file is missing)/i);
});
it("Invalid command exit code = 1", () => {
expect(resultInvalid.exitCode).toBe(1);
});
it("Invalid solc exit code == Invalid zksolc exit code", () => {
it("Invalid solc exit code == Invalid resolc exit code", () => {
const command = 'solc --yul';
const solcResult = executeCommand(command);
expect(solcResult.exitCode).toBe(resultInvalid.exitCode);