Skip to content

Commit

Permalink
feat: integrate compiler suppressed warnings/errors feature for upstr…
Browse files Browse the repository at this point in the history
…eam merge 57bb12e  (#704)

* integrate compilers suppressed warnings/errors functionality
  • Loading branch information
nbaztec authored Nov 6, 2024
1 parent 55fa294 commit 149ef4f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 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 @@ -121,6 +122,26 @@ pub struct ZkSyncArgs {
visible_alias = "paymaster-input"
)]
pub paymaster_input: Option<Bytes>,

/// Set the warnings to suppress for zksolc.
#[clap(
long = "zk-suppressed-warnings",
visible_alias = "suppressed-warnings",
value_delimiter = ',',
help = "Set the warnings to suppress for zksolc, possible values: [txorigin]"
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub suppressed_warnings: Option<Vec<ZkSolcWarning>>,

/// Set the errors to suppress for zksolc.
#[clap(
long = "zk-suppressed-errors",
visible_alias = "suppressed-errors",
value_delimiter = ',',
help = "Set the errors to suppress for zksolc, possible values: [sendtransfer]"
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub suppressed_errors: Option<Vec<ZkSolcError>>,
}

impl ZkSyncArgs {
Expand Down Expand Up @@ -157,6 +178,14 @@ impl ZkSyncArgs {
self.optimizer_mode.as_ref().and_then(|mode| mode.parse::<char>().ok()),
zksync.optimizer_mode
);
let suppressed_warnings = self
.suppressed_warnings
.clone()
.map(|values| values.into_iter().collect::<HashSet<_>>());
set_if_some!(suppressed_warnings, zksync.suppressed_warnings);
let suppressed_errors =
self.suppressed_errors.clone().map(|values| values.into_iter().collect::<HashSet<_>>());
set_if_some!(suppressed_errors, zksync.suppressed_errors);

zksync
}
Expand Down
9 changes: 3 additions & 6 deletions crates/config/src/zksync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ use foundry_compilers::{
},
};

use revm_primitives::HashSet;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::{collections::HashSet, path::PathBuf};

use crate::SolcReq;

Expand Down Expand Up @@ -140,10 +139,8 @@ impl ZkSyncConfig {
},
},
codegen: if self.force_evmla { Codegen::EVMLA } else { Codegen::Yul },
suppressed_warnings: Default::default(), /* TODO(zk): take from self when `FromStr`
* impl is provided */
suppressed_errors: Default::default(), /* TODO(zk): take from self when `FromStr`
* impl is provided */
suppressed_warnings: self.suppressed_warnings.clone(),
suppressed_errors: self.suppressed_errors.clone(),
};

// `cli_settings` get set from `Project` values when building `ZkSolcVersionedInput`
Expand Down

0 comments on commit 149ef4f

Please sign in to comment.