From 4144021661c62d7f54f33bf5c021a871d93290b5 Mon Sep 17 00:00:00 2001 From: Tomi Moreno <166135794+tomimor@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:20:34 -0300 Subject: [PATCH 1/2] docs: windows compatibility clarification (#500) Co-authored-by: Nisheeth Barthwal --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ffc311d7..7c020d69a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository enhances Foundry to support zkSync Era, enabling Solidity-based > 🔧 **Fork Notice:** This is a Foundry fork with added zkSync support. > -> ⚠️ **Alpha Stage:** The project is in alpha, so you might encounter issues. +> ⚠️ **Alpha Stage:** The project is in alpha, so you might encounter issues. For more information, please review [Limitations](#limitations) section. > > 🐞 **Found an Issue?** Please report it to help us improve. @@ -59,6 +59,7 @@ While `foundry-zksync` is **alpha stage**, there are some limitations to be awar - **Contract Verification**: Currently contract verification via the `--verify` flag do not work as expected but will be added shortly. - **Specific Foundry Features**: Currently features such as `--gas-report`, `--coverage` may not work as intended. We are actively working on providing support for these feature types. - **Solc Compatibility**: `zksolc` requires a `solc` binary to be run as a child process. The version/path to use for each can be specified by the `zksolc` and `solc` options in `foundry.toml`. Not all `solc` versions are supported by all `zksolc` versions, compiling with a `solc` version higher than the one supported may lead to unexpected errors. [Read the docs](https://docs.zksync.io/zk-stack/components/compiler/toolchain/solidity.html#limitations) about version limitations and check the [zksolc changelog](https://github.com/matter-labs/era-compiler-solidity/blob/main/CHANGELOG.md) to see the latest supported `solc` version. +- **Windows Compatibility**: Windows is not officially supported yet. The reported issues would be investigated on a best-effort basis. For the most effective use of our library, we recommend familiarizing yourself with these features and limitations. From 0ae6903f00e103c2402380fea8fbe643b6f7ca22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Rodr=C3=ADguez?= Date: Tue, 6 Aug 2024 16:45:35 -0300 Subject: [PATCH 2/2] chore: do not setup zksolc in multicompiler project (#506) --- crates/config/src/lib.rs | 66 +--------------------------------------- 1 file changed, 1 insertion(+), 65 deletions(-) diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index c84c45031..271d53681 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -29,12 +29,10 @@ use foundry_compilers::{ multi::{MultiCompiler, MultiCompilerSettings}, solc::{Solc, SolcCompiler}, vyper::{Vyper, VyperSettings}, - zksolc::ZkSolc, Compiler, }, error::SolcError, zksolc::ZkSolcSettings, - zksync::config::ZkSolcConfig, ConfigurableArtifacts, Project, ProjectPathsConfig, }; use inflector::Inflector; @@ -822,36 +820,12 @@ impl Config { builder = builder.sparse_output(filter); } - let mut project = builder.build(self.compiler()?)?; + let project = builder.build(self.compiler()?)?; if self.force { self.cleanup(&project)?; } - // Set up zksolc project values - // TODO: maybe some of these could be included - // when setting up the builder for the sake of consistency (requires dedicated - // builder methods) - project.zksync_zksolc_config = ZkSolcConfig { settings: self.zksync_zksolc_settings()? }; - - if let Some(zksolc) = self.zksync_ensure_zksolc()? { - project.zksync_zksolc = zksolc; - } else { - // TODO: we automatically install a zksolc version - // if none is found, but maybe we should mirror auto detect settings - // as done with solc - if !self.offline { - let default_version = Version::new(1, 4, 1); - let mut zksolc = ZkSolc::find_installed_version(&default_version)?; - if zksolc.is_none() { - ZkSolc::blocking_install(&default_version)?; - zksolc = ZkSolc::find_installed_version(&default_version)?; - } - project.zksync_zksolc = zksolc - .unwrap_or_else(|| panic!("Could not install zksolc v{}", default_version)); - } - } - Ok(project) } @@ -911,44 +885,6 @@ impl Config { Ok(None) } - /// Ensures that the configured version is installed if explicitly set - /// - /// If `zksolc` is [`SolcReq::Version`] then this will download and install the solc version if - /// it's missing, unless the `offline` flag is enabled, in which case an error is thrown. - /// - /// If `zksolc` is [`SolcReq::Local`] then this will ensure that the path exists. - fn zksync_ensure_zksolc(&self) -> Result, SolcError> { - if let Some(ref zksolc) = self.zksync.zksolc { - let zksolc = match zksolc { - SolcReq::Version(version) => { - let mut zksolc = ZkSolc::find_installed_version(version)?; - if zksolc.is_none() { - if self.offline { - return Err(SolcError::msg(format!( - "can't install missing zksolc {version} in offline mode" - ))) - } - ZkSolc::blocking_install(version)?; - zksolc = ZkSolc::find_installed_version(version)?; - } - zksolc - } - SolcReq::Local(zksolc) => { - if !zksolc.is_file() { - return Err(SolcError::msg(format!( - "`zksolc` {} does not exist", - zksolc.display() - ))) - } - Some(ZkSolc::new(zksolc)) - } - }; - return Ok(zksolc) - } - - Ok(None) - } - /// Returns the [SpecId] derived from the configured [EvmVersion] #[inline] pub fn evm_spec_id(&self) -> SpecId {