Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate compiler suppressed warnings/errors feature for upstream merge 57bb12e #704

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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