Skip to content

Commit

Permalink
feat: add suppressed error/warnings as cli argumetns
Browse files Browse the repository at this point in the history
  • Loading branch information
elfedy committed Nov 4, 2024
1 parent 5c2e7e8 commit 5668b6f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/cli/src/opts/build/zksync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;
use std::{collections::HashSet, path::PathBuf};

use clap::Parser;
use foundry_compilers::zksolc::settings::{ZkSolcError, ZkSolcWarning};
use foundry_config::ZkSyncConfig;
use serde::Serialize;
use zksync_web3_rs::types::{Address, Bytes};
Expand Down Expand Up @@ -102,6 +103,14 @@ pub struct ZkSyncArgs {
#[clap(long = "zk-optimizer")]
pub optimizer: bool,

/// zksolc suppressed warnings

Check failure on line 106 in crates/cli/src/opts/build/zksync.rs

View workflow job for this annotation

GitHub Actions / zk-cargo-test

the method `value_parser` exists for reference `&&&&&&_infer_ValueParser_for<ZkSolcWarning>`, but its trait bounds were not satisfied

Check failure on line 106 in crates/cli/src/opts/build/zksync.rs

View workflow job for this annotation

GitHub Actions / zk-cargo-test

the method `value_parser` exists for reference `&&&&&&_infer_ValueParser_for<ZkSolcWarning>`, but its trait bounds were not satisfied
#[clap(long = "zk-suppressed-warnings")]
pub suppressed_warnings: Option<Vec<ZkSolcWarning>>,

/// zksolc suppressed errors

Check failure on line 110 in crates/cli/src/opts/build/zksync.rs

View workflow job for this annotation

GitHub Actions / zk-cargo-test

the method `value_parser` exists for reference `&&&&&&_infer_ValueParser_for<ZkSolcError>`, but its trait bounds were not satisfied

Check failure on line 110 in crates/cli/src/opts/build/zksync.rs

View workflow job for this annotation

GitHub Actions / zk-cargo-test

the method `value_parser` exists for reference `&&&&&&_infer_ValueParser_for<ZkSolcError>`, but its trait bounds were not satisfied
#[clap(long = "zk-suppressed-errors")]
pub suppressed_errors: Option<Vec<ZkSolcError>>,

/// Contracts to avoid compiling on zkSync
#[clap(long = "zk-avoid-contracts", visible_alias = "avoid-contracts", value_delimiter = ',')]
pub avoid_contracts: Option<Vec<String>>,
Expand Down Expand Up @@ -153,6 +162,10 @@ impl ZkSyncArgs {
set_if_some!(self.avoid_contracts.clone(), zksync.avoid_contracts);

set_if_some!(self.optimizer.then_some(true), zksync.optimizer);
let maybe_suppressed_warnings = self.suppressed_warnings.clone().map(HashSet::from_iter);
set_if_some!(maybe_suppressed_warnings, zksync.suppressed_warnings);
let maybe_suppressed_errors = self.suppressed_errors.clone().map(HashSet::from_iter);
set_if_some!(maybe_suppressed_errors, zksync.suppressed_errors);
set_if_some!(
self.optimizer_mode.as_ref().and_then(|mode| mode.parse::<char>().ok()),
zksync.optimizer_mode
Expand Down

0 comments on commit 5668b6f

Please sign in to comment.