From c8e23ef319b58008adba8fe947e1717caca64ed7 Mon Sep 17 00:00:00 2001 From: Juan Rigada <62958725+Jrigada@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:07:33 -0300 Subject: [PATCH] fix: Update dependency foundry compilers use of ZksolcSettings (#544) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update foundry compilers for latest changes of ZksolcSettings * Update crates/config/src/zksync.rs Co-authored-by: Federico Rodríguez * cargo fmt --------- Co-authored-by: Jrigada Co-authored-by: Federico Rodríguez --- Cargo.lock | 12 ++++++------ crates/config/src/zksync.rs | 13 ++++++++----- crates/verify/src/etherscan/flatten.rs | 8 +++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2f5852de..be6d27175 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5038,7 +5038,7 @@ dependencies = [ [[package]] name = "foundry-compilers" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -5078,7 +5078,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "foundry-compilers-artifacts-solc", "foundry-compilers-artifacts-vyper", @@ -5088,7 +5088,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-solc" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -5111,7 +5111,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-vyper" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -5125,7 +5125,7 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-zksolc" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -5146,7 +5146,7 @@ dependencies = [ [[package]] name = "foundry-compilers-core" version = "0.10.0" -source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#b597d1d8887e2568dda08f81c45d3ec2df832a46" +source = "git+https://github.com/Moonsong-Labs/compilers?branch=zksync-v0.10.0#7719a78a44fa451a84228b68ce0118e08919ed34" dependencies = [ "alloy-primitives", "cfg-if 1.0.0", diff --git a/crates/config/src/zksync.rs b/crates/config/src/zksync.rs index 41ee5fec5..5265b9ca1 100644 --- a/crates/config/src/zksync.rs +++ b/crates/config/src/zksync.rs @@ -4,8 +4,9 @@ use foundry_compilers::{ EvmVersion, Libraries, }, solc::CliSettings, - zksolc::settings::{ - BytecodeHash, Optimizer, OptimizerDetails, SettingsMetadata, ZkSolcSettings, + zksolc::{ + settings::{BytecodeHash, Optimizer, OptimizerDetails, SettingsMetadata, ZkSolcSettings}, + ZkSettings, }, }; @@ -108,7 +109,7 @@ impl ZkSyncConfig { jump_table_density_threshold: None, }; - ZkSolcSettings { + let zk_settings = ZkSettings { libraries, optimizer, evm_version: Some(evm_version), @@ -126,8 +127,10 @@ impl ZkSyncConfig { per_contract: Some([OutputSelectionFlag::ABI].into()), }), }, - cli_settings: CliSettings::default(), - } + }; + + // `cli_settings` get set from `Project` values when building `ZkSolcVersionedInput` + ZkSolcSettings { settings: zk_settings, cli_settings: CliSettings::default() } } pub fn avoid_contracts(&self) -> Option> { diff --git a/crates/verify/src/etherscan/flatten.rs b/crates/verify/src/etherscan/flatten.rs index f0a3181be..0ce7571a3 100644 --- a/crates/verify/src/etherscan/flatten.rs +++ b/crates/verify/src/etherscan/flatten.rs @@ -12,7 +12,7 @@ use foundry_compilers::{ solc::{SolcCompiler, SolcLanguage, SolcVersionedInput}, Compiler, CompilerInput, }, - solc::Solc, + solc::{CliSettings, Solc}, zksolc::{ input::{ZkSolcInput, ZkSolcVersionedInput}, ZkSolc, ZkSolcCompiler, @@ -70,7 +70,7 @@ impl EtherscanSourceProvider for EtherscanFlattenedSource { args: &VerifyArgs, context: &ZkVerificationContext, ) -> Result<(String, String, CodeFormat)> { - let metadata = context.project.settings.metadata.as_ref(); + let metadata = context.project.settings.settings.metadata.as_ref(); let bch = metadata.and_then(|m| m.bytecode_hash).unwrap_or_default(); eyre::ensure!( @@ -190,9 +190,7 @@ Diagnostics: {diags}", ..Default::default() }, solc_version: solc_version.clone(), - allow_paths: Default::default(), - base_path: Default::default(), - include_paths: Default::default(), + cli_settings: CliSettings::default(), }; let solc_compiler = if compiler_version.is_zksync_solc {