From 6f080bb9f43ecd321eddd2151dcdbdb5bc02f2db Mon Sep 17 00:00:00 2001 From: xermicus Date: Wed, 8 May 2024 11:16:24 +0200 Subject: [PATCH] rename binary to resolc Signed-off-by: xermicus --- README.md | 2 +- crates/common/README.md | 27 +------------------ .../src/polkavm/context/debug_info.rs | 2 +- crates/solidity/Cargo.toml | 4 +-- crates/solidity/src/build/mod.rs | 8 +++--- crates/solidity/src/const.rs | 2 +- crates/solidity/src/lib.rs | 10 +++---- crates/solidity/src/missing_libraries.rs | 4 +-- .../src/{zksolc => resolc}/arguments.rs | 6 ++--- .../solidity/src/{zksolc => resolc}/main.rs | 0 crates/solidity/src/solc/combined_json/mod.rs | 2 +- .../src/solc/standard_json/output/mod.rs | 2 +- .../solidity/src/tests/cli-tests/package.json | 9 ++++--- .../src/tests/cli-tests/tests/asm.test.ts | 10 +++---- .../src/tests/cli-tests/tests/common.test.ts | 10 +++---- .../src/tests/cli-tests/tests/yul.test.ts | 10 +++---- 16 files changed, 43 insertions(+), 65 deletions(-) rename crates/solidity/src/{zksolc => resolc}/arguments.rs (98%) rename crates/solidity/src/{zksolc => resolc}/main.rs (100%) diff --git a/README.md b/README.md index 7dc7748..8bc2fb1 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,4 @@ The project is in a very early PoC phase. Don't yet expect the produced code to - [ ] Minimize scope of "stdlib" - [ ] Document differences from EVM - [ ] Audit for bugs and correctness -- [ ] Rebranding +- [x] Rebranding diff --git a/crates/common/README.md b/crates/common/README.md index 5b6fd47..6eb27ae 100644 --- a/crates/common/README.md +++ b/crates/common/README.md @@ -1,13 +1,4 @@ -# zkSync Era: Compiler Common - -[![Logo](eraLogo.svg)](https://zksync.io/) - -zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security -or decentralization. As it's EVM-compatible (with Solidity/Vyper), 99% of Ethereum projects can redeploy without -needing to refactor or re-audit any code. zkSync Era also uses an LLVM-based compiler that will eventually enable -developers to write smart contracts in popular languages such as C++ and Rust. - -This repository contains the common compiler constants. +# revive: Compiler Common ## License @@ -17,19 +8,3 @@ This library is distributed under the terms of either - MIT license ([LICENSE-MIT](LICENSE-MIT) or ) at your option. - -## Official Links - -- [Website](https://zksync.io/) -- [GitHub](https://github.com/matter-labs) -- [Twitter](https://twitter.com/zksync) -- [Twitter for Devs](https://twitter.com/zkSyncDevs) -- [Discord](https://join.zksync.dev/) - -## Disclaimer - -zkSync Era has been through extensive testing and audits, and although it is live, it is still in alpha state and -will undergo further audits and bug bounty programs. We would love to hear our community's thoughts and suggestions -about it! -It's important to note that forking it now could potentially lead to missing important -security updates, critical features, and performance improvements. diff --git a/crates/llvm-context/src/polkavm/context/debug_info.rs b/crates/llvm-context/src/polkavm/context/debug_info.rs index 619fd81..d90ad01 100644 --- a/crates/llvm-context/src/polkavm/context/debug_info.rs +++ b/crates/llvm-context/src/polkavm/context/debug_info.rs @@ -45,7 +45,7 @@ impl<'ctx> DebugInfo<'ctx> { ) -> anyhow::Result> { let subroutine_type = self.builder.create_subroutine_type( self.compile_unit.get_file(), - Some(self.create_type(era_compiler_common::BIT_LENGTH_FIELD)?), + Some(self.create_type(revive_common::BIT_LENGTH_FIELD)?), &[], inkwell::debug_info::DIFlags::zero(), ); diff --git a/crates/solidity/Cargo.toml b/crates/solidity/Cargo.toml index 2ff421e..3be2d9d 100644 --- a/crates/solidity/Cargo.toml +++ b/crates/solidity/Cargo.toml @@ -10,8 +10,8 @@ edition = "2021" description = "PolkaVM Solidity frontend" [[bin]] -name = "zksolc" -path = "src/zksolc/main.rs" +name = "resolc" +path = "src/resolc/main.rs" [lib] doctest = false diff --git a/crates/solidity/src/build/mod.rs b/crates/solidity/src/build/mod.rs index 0c406d5..e731754 100644 --- a/crates/solidity/src/build/mod.rs +++ b/crates/solidity/src/build/mod.rs @@ -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(()) } diff --git a/crates/solidity/src/const.rs b/crates/solidity/src/const.rs index 2763192..bec342d 100644 --- a/crates/solidity/src/const.rs +++ b/crates/solidity/src/const.rs @@ -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; diff --git a/crates/solidity/src/lib.rs b/crates/solidity/src/lib.rs index ae258a7..ad7cec7 100644 --- a/crates/solidity/src/lib.rs +++ b/crates/solidity/src/lib.rs @@ -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, 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) => { diff --git a/crates/solidity/src/missing_libraries.rs b/crates/solidity/src/missing_libraries.rs index 6901802..d3edccc 100644 --- a/crates/solidity/src/missing_libraries.rs +++ b/crates/solidity/src/missing_libraries.rs @@ -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(()) } diff --git a/crates/solidity/src/zksolc/arguments.rs b/crates/solidity/src/resolc/arguments.rs similarity index 98% rename from crates/solidity/src/zksolc/arguments.rs rename to crates/solidity/src/resolc/arguments.rs index 9303f01..aba46a1 100644 --- a/crates/solidity/src/zksolc/arguments.rs +++ b/crates/solidity/src/resolc/arguments.rs @@ -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, /// 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, diff --git a/crates/solidity/src/zksolc/main.rs b/crates/solidity/src/resolc/main.rs similarity index 100% rename from crates/solidity/src/zksolc/main.rs rename to crates/solidity/src/resolc/main.rs diff --git a/crates/solidity/src/solc/combined_json/mod.rs b/crates/solidity/src/solc/combined_json/mod.rs index a79703a..696f6fe 100644 --- a/crates/solidity/src/solc/combined_json/mod.rs +++ b/crates/solidity/src/solc/combined_json/mod.rs @@ -26,7 +26,7 @@ pub struct CombinedJson { pub sources: Option, /// 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, } diff --git a/crates/solidity/src/solc/standard_json/output/mod.rs b/crates/solidity/src/solc/standard_json/output/mod.rs index 9dbd46b..027a122 100644 --- a/crates/solidity/src/solc/standard_json/output/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/mod.rs @@ -43,7 +43,7 @@ pub struct Output { /// The `solc` compiler long version. #[serde(skip_serializing_if = "Option::is_none")] pub long_version: Option, - /// The `zksolc` compiler version. + /// The `resolc` compiler version. #[serde(skip_serializing_if = "Option::is_none")] pub zk_version: Option, } diff --git a/crates/solidity/src/tests/cli-tests/package.json b/crates/solidity/src/tests/cli-tests/package.json index e69b8e4..a7df125 100644 --- a/crates/solidity/src/tests/cli-tests/package.json +++ b/crates/solidity/src/tests/cli-tests/package.json @@ -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", diff --git a/crates/solidity/src/tests/cli-tests/tests/asm.test.ts b/crates/solidity/src/tests/cli-tests/tests/asm.test.ts index 299bcb9..6c178d6 100644 --- a/crates/solidity/src/tests/cli-tests/tests/asm.test.ts +++ b/crates/solidity/src/tests/cli-tests/tests/asm.test.ts @@ -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); diff --git a/crates/solidity/src/tests/cli-tests/tests/common.test.ts b/crates/solidity/src/tests/cli-tests/tests/common.test.ts index 74ab073..ea5a8f7 100644 --- a/crates/solidity/src/tests/cli-tests/tests/common.test.ts +++ b/crates/solidity/src/tests/cli-tests/tests/common.test.ts @@ -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", () => { diff --git a/crates/solidity/src/tests/cli-tests/tests/yul.test.ts b/crates/solidity/src/tests/cli-tests/tests/yul.test.ts index ee01821..79700b3 100644 --- a/crates/solidity/src/tests/cli-tests/tests/yul.test.ts +++ b/crates/solidity/src/tests/cli-tests/tests/yul.test.ts @@ -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);