Skip to content

Commit

Permalink
Improved message on compiler error and added support for 1.3.10 (#91)
Browse files Browse the repository at this point in the history
* added better compiler error passing and support for version 1.3.10

* added comments

* more instructions

* more info
  • Loading branch information
mm-zk authored May 26, 2023
1 parent 9f225d2 commit 69e511f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ $ git clone https://github.com/sammyshakes/sample-fzksync-project.git
# cd into foundry-zksync and build
$ cd foundry-zksync
$ cargo build -p foundry-cli
# cd into fzksync-project and update the submodules
$ cd ../sample-fzksync-project
$ git submodule update --init --recursive
```
---

Expand Down Expand Up @@ -654,3 +657,11 @@ There are 2 workarounds:
- download the compiler manually - and then use `--offline` mode (you can download the compiler into ~/.svm/VERSION/solc-VERSION -- for example ~/.svm/0.8.20/solc-0.8.20 )
You can get the lastest compiler version for MacOs AARCH here: https://github.com/ethers-rs/solc-builds/tree/master/macosx/aarch64
### `solc` versions >0.8.19 are not supported, found 0.8.20
This means that our zksync compiler doesn't support that version of solidity yet.
In such case, please remove the artifacts (by removing `zkout` directory) and re-run with the older version of solidity (`--use 0.8.19`) for example.
You might also have to remove `~/.svm/0.8.20/solc-0.8.20` file too.
10 changes: 10 additions & 0 deletions cli/src/cmd/forge/zksolc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ impl ZkSolc {
.wait_with_output()
.map_err(|e| Error::msg(format!("Could not run compiler cmd: {}", e)))?;

if !output.status.success() {
return Err(Error::msg(format!(
"Compilation failed with {:?}. Using compiler: {:?}, with args {:?} {:?}",
String::from_utf8(output.stderr).unwrap_or_default(),
self.compiler_path,
contract_path,
&comp_args
)));
}

let filename = contract_path
.to_str()
.expect("Unable to convert source to string")
Expand Down
3 changes: 3 additions & 0 deletions cli/src/cmd/forge/zksolc_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub enum ZkSolcVersion {
V137,
V138,
V139,
V1310,
}

/// `parse_version` parses a string representation of a `zksolc` compiler version
Expand All @@ -68,6 +69,7 @@ fn parse_version(version: &str) -> Result<ZkSolcVersion> {
"v1.3.7" => Ok(ZkSolcVersion::V137),
"v1.3.8" => Ok(ZkSolcVersion::V138),
"v1.3.9" => Ok(ZkSolcVersion::V139),
"v1.3.10" => Ok(ZkSolcVersion::V1310),
_ => Err(Error::msg(
"ZkSolc compiler version not supported. Proper version format: 'v1.3.x'",
)),
Expand All @@ -87,6 +89,7 @@ impl ZkSolcVersion {
ZkSolcVersion::V137 => "v1.3.7",
ZkSolcVersion::V138 => "v1.3.8",
ZkSolcVersion::V139 => "v1.3.9",
ZkSolcVersion::V1310 => "v1.3.10",
}
}
}
Expand Down

0 comments on commit 69e511f

Please sign in to comment.