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
+1 -1
View File
@@ -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
+1 -26
View File
@@ -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 <http://opensource.org/licenses/MIT>)
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.
@@ -45,7 +45,7 @@ impl<'ctx> DebugInfo<'ctx> {
) -> anyhow::Result<inkwell::debug_info::DISubprogram<'ctx>> {
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(),
);
+2 -2
View File
@@ -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
+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);