Skip to content

Commit

Permalink
use lib
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Jun 18, 2024
1 parent 8d1bd85 commit 3a75be7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions core/lib/contract_verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ lazy_static.workspace = true
tempfile.workspace = true
regex.workspace = true
tracing.workspace = true
semver.workspace = true
16 changes: 8 additions & 8 deletions core/lib/contract_verifier/src/zksolc_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, io::Write, path::PathBuf, process::Stdio};

use regex::Regex;
use semver::Version;
use serde::{Deserialize, Serialize};

use crate::error::ContractVerifierError;
Expand Down Expand Up @@ -200,18 +200,18 @@ impl ZkSolc {
}

pub fn is_post_1_5_0(&self) -> bool {
// Special case
if &self.zksolc_version == "vm-1.5.0-a167aa3" {
false
} else {
let re =
Regex::new(r"^v(?<MAJOR>(?:0|(?:[1-9]\d*)))\.(?<MINOR>(?:0|(?:[1-9]\d*)))\.(?<PATCH>(?:0|(?:[1-9]\d*)))")
.unwrap();
if let Some(caps) = re.captures(&self.zksolc_version) {
(caps["MAJOR"].len() > 1 || &caps["MAJOR"] > "1")
|| (&caps["MAJOR"] == "1" && (caps["MINOR"].len() > 1 || &caps["MINOR"] >= "5"))
} else if let Some(version) = self.zksolc_version.strip_prefix("v") {
if let Ok(semver) = Version::parse(version) {
let target = Version::new(1, 5, 0);
semver >= target
} else {
true
}
} else {
true
}
}
}
Expand Down

0 comments on commit 3a75be7

Please sign in to comment.