diff --git a/Cargo.lock b/Cargo.lock index 4f47b9c7b..1ec8c5004 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3922,8 +3922,8 @@ dependencies = [ [[package]] name = "era-solc" -version = "1.5.9" -source = "git+https://github.com/matter-labs/era-compiler-solidity.git?rev=b8265327d1530a2ba42473e37756aeebfb0fed75#b8265327d1530a2ba42473e37756aeebfb0fed75" +version = "1.5.10" +source = "git+https://github.com/matter-labs/era-compiler-solidity.git?tag=1.5.10#0c9df3b260c95e0881799bb3b2c85bd16a6dbf4d" dependencies = [ "anyhow", "boolinator", diff --git a/Cargo.toml b/Cargo.toml index f067a95d9..2a9d9732b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -256,7 +256,7 @@ zksync_vm_interface = { git = "https://github.com/matter-labs/zksync-era.git", r zksync_multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" } zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" } zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" } -era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity.git", rev = "b8265327d1530a2ba42473e37756aeebfb0fed75", package = "era-solc" } +era-solc = { git = "https://github.com/matter-labs/era-compiler-solidity.git", tag = "1.5.10", package = "era-solc" } # macros proc-macro2 = "1.0" diff --git a/crates/cli/src/opts/build/zksync.rs b/crates/cli/src/opts/build/zksync.rs index f3b412b19..4964ce230 100644 --- a/crates/cli/src/opts/build/zksync.rs +++ b/crates/cli/src/opts/build/zksync.rs @@ -117,10 +117,10 @@ pub struct ZkSyncArgs { /// Set the warnings to suppress for zksolc. #[clap( long = "zk-suppressed-warnings", - alias = "suppressed-warnings", + alias = "suppressed-warnings", visible_alias = "suppress-warnings", value_delimiter = ',', - help = "Set the warnings to suppress for zksolc, possible values: [txorigin]" + help = "Set the warnings to suppress for zksolc, possible values: [txorigin, assemblycreate]" )] #[serde(skip_serializing_if = "Option::is_none")] pub suppressed_warnings: Option>, @@ -131,7 +131,7 @@ pub struct ZkSyncArgs { alias = "suppressed-errors", visible_alias = "suppress-errors", value_delimiter = ',', - help = "Set the errors to suppress for zksolc, possible values: [sendtransfer, assemblycreate]" + help = "Set the errors to suppress for zksolc, possible values: [sendtransfer]" )] #[serde(skip_serializing_if = "Option::is_none")] pub suppressed_errors: Option>, diff --git a/crates/config/src/zksync.rs b/crates/config/src/zksync.rs index 3185cf578..12db3a329 100644 --- a/crates/config/src/zksync.rs +++ b/crates/config/src/zksync.rs @@ -198,7 +198,7 @@ pub fn config_create_project( { zksolc } else if !config.offline { - let default_version = semver::Version::new(1, 5, 7); + let default_version = semver::Version::new(1, 5, 10); let mut zksolc = ZkSolc::find_installed_version(&default_version)?; if zksolc.is_none() { ZkSolc::blocking_install(&default_version)?; diff --git a/crates/forge/tests/it/test_helpers.rs b/crates/forge/tests/it/test_helpers.rs index b8be5ce8e..a9d34e679 100644 --- a/crates/forge/tests/it/test_helpers.rs +++ b/crates/forge/tests/it/test_helpers.rs @@ -201,7 +201,7 @@ impl ForgeTestProfile { zk_config.zksync.startup = true; zk_config.zksync.fallback_oz = true; zk_config.zksync.optimizer_mode = '3'; - zk_config.zksync.zksolc = Some(foundry_config::SolcReq::Version(Version::new(1, 5, 7))); + zk_config.zksync.zksolc = Some(foundry_config::SolcReq::Version(Version::new(1, 5, 10))); zk_config.fuzz.no_zksync_reserved_addresses = true; zk_config.invariant.depth = 15; diff --git a/crates/script/src/verify.rs b/crates/script/src/verify.rs index bf224f041..0ccc9a323 100644 --- a/crates/script/src/verify.rs +++ b/crates/script/src/verify.rs @@ -210,7 +210,7 @@ impl VerifyBundle { let contract_bytecode_hash = foundry_zksync_core::hash_bytecode(bytecode); if bytecode_hash == contract_bytecode_hash { - if artifact.source.extension().map_or(false, |e| e.to_str() == Some("vy")) { + if artifact.source.extension().is_some_and(|e| e.to_str() == Some("vy")) { warn!("Skipping verification of Vyper contract: {}", artifact.name); } diff --git a/crates/zksync/compilers/src/compilers/zksolc/mod.rs b/crates/zksync/compilers/src/compilers/zksolc/mod.rs index c4a96a109..113abb301 100644 --- a/crates/zksync/compilers/src/compilers/zksolc/mod.rs +++ b/crates/zksync/compilers/src/compilers/zksolc/mod.rs @@ -40,7 +40,7 @@ pub const ZKSOLC: &str = "zksolc"; /// ZKsync solc release used for all ZKsync solc versions pub const ZKSYNC_SOLC_RELEASE: Version = Version::new(1, 0, 1); /// Default zksolc version -pub const ZKSOLC_VERSION: Version = Version::new(1, 5, 9); +pub const ZKSOLC_VERSION: Version = Version::new(1, 5, 10); #[cfg(test)] macro_rules! take_solc_installer_lock { @@ -436,12 +436,6 @@ impl ZkSolc { pub fn compile_output(&self, input: &ZkSolcInput) -> Result> { let mut cmd = Command::new(&self.zksolc); - // Add the `--suppress-errors assemblycreate` flag for zksolc versions >= 1.5.9 - // This prevents compile errors during foundry project compilation - if self.solc_version_info.zksync_version.as_ref() >= Some(&Version::new(1, 5, 9)) { - cmd.arg("--suppress-errors").arg("assemblycreate"); - } - if !self.allow_paths.is_empty() { cmd.arg("--allow-paths"); cmd.arg(self.allow_paths.iter().map(|p| p.display()).join(",")); diff --git a/crates/zksync/compilers/tests/zksync_tests.rs b/crates/zksync/compilers/tests/zksync_tests.rs index a913f856d..bb3e4a2d1 100644 --- a/crates/zksync/compilers/tests/zksync_tests.rs +++ b/crates/zksync/compilers/tests/zksync_tests.rs @@ -166,7 +166,7 @@ fn zksync_pre_1_5_7_can_compile_contract_with_suppressed_warnings() { test_zksync_can_compile_contract_with_suppressed_warnings(compiler); } -fn test_zksync_can_compile_contract_with_assembly_create_suppressed_errors( +fn test_zksync_can_compile_contract_with_assembly_create_suppressed_warnings( compiler: ZkSolcCompiler, ) { let mut project = TempProject::::dapptools().unwrap(); @@ -174,11 +174,11 @@ fn test_zksync_can_compile_contract_with_assembly_create_suppressed_errors( project .add_source( - "Erroneous", + "Warning", r#" // SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.10; - contract Erroneous { + contract Warning { function deployWithCreate(bytes memory bytecode) public returns (address addr) { assembly { addr := create(0, add(bytecode, 0x20), mload(bytecode)) @@ -189,24 +189,44 @@ fn test_zksync_can_compile_contract_with_assembly_create_suppressed_errors( ) .unwrap(); + // Compile the project and ensure it succeeds with warnings let compiled = project.compile().unwrap(); - assert!(compiled.has_compiler_errors()); + compiled.assert_success(); + assert!( + compiled + .output() + .errors + .iter() + .any(|err| err.is_warning() && err.message.contains("create")), + "Expected assembly `create` warning, but none found: {:#?}", + compiled.output().errors + ); - project.project_mut().settings.settings.suppressed_errors = - HashSet::from([ErrorType::AssemblyCreate]); + project.project_mut().settings.settings.suppressed_warnings = + HashSet::from([WarningType::AssemblyCreate]); let compiled = project.compile().unwrap(); compiled.assert_success(); - assert!(compiled.find_first("Erroneous").is_some()); + assert!(compiled.find_first("Warning").is_some()); + + assert!( + !compiled + .output() + .errors + .iter() + .any(|err| err.is_warning() && err.message.contains("create")), + "Assembly `create` warning was not suppressed: {:#?}", + compiled.output().errors + ) } #[test] -fn zksync_can_compile_contract_with_assembly_create_suppressed_errors() { +fn zksync_can_compile_contract_with_assembly_create_suppressed_warnings_1_5_10() { let compiler = ZkSolcCompiler { - zksolc: ZkSolc::get_path_for_version(&semver::Version::new(1, 5, 9)).unwrap(), + zksolc: ZkSolc::get_path_for_version(&semver::Version::new(1, 5, 10)).unwrap(), solc: Default::default(), }; - test_zksync_can_compile_contract_with_assembly_create_suppressed_errors(compiler); + test_zksync_can_compile_contract_with_assembly_create_suppressed_warnings(compiler); } #[test] @@ -536,7 +556,7 @@ contract Util {} assert!(compiled.output().errors.iter().any(|error| error .formatted_message .as_ref() - .map_or(false, |msg| msg.contains("File outside of allowed directories")))); + .is_some_and(|msg| msg.contains("File outside of allowed directories")))); } #[test]