From 01eb12a53fdb6d9a4155a8cbc78859658eeb7b68 Mon Sep 17 00:00:00 2001 From: elfedy Date: Fri, 17 Jan 2025 15:15:06 -0300 Subject: [PATCH] Fail when specifying unsupported versions --- crates/zksync/compilers/src/compilers/zksolc/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/zksync/compilers/src/compilers/zksolc/mod.rs b/crates/zksync/compilers/src/compilers/zksolc/mod.rs index bfab9adc8..7a44cd733 100644 --- a/crates/zksync/compilers/src/compilers/zksolc/mod.rs +++ b/crates/zksync/compilers/src/compilers/zksolc/mod.rs @@ -583,6 +583,18 @@ impl ZkSolc { /// Get path for installed zksolc version. Returns `Ok(None)` if not installed pub fn find_installed_version(version: &Version) -> Result> { + let min_supported_version = Self::zksolc_minimum_supported_version(); + let latest_supported_version = Self::zksolc_latest_supported_version(); + if *version < min_supported_version { + return Err(SolcError::msg(format!( + "Specifying zksolc v{version} not supported. Minimum version supported is v{min_supported_version}" + ))); + } + if *version > latest_supported_version { + return Err(SolcError::msg(format!( + "Specifying zksolc v{version} not supported. Latest version supported is v{latest_supported_version}" + ))); + } let zksolc = Self::compiler_path(version)?; if !zksolc.is_file() {