diff --git a/crates/compilers/src/compilers/zksolc/settings.rs b/crates/compilers/src/compilers/zksolc/settings.rs index 9c6d6f47..76c228c5 100644 --- a/crates/compilers/src/compilers/zksolc/settings.rs +++ b/crates/compilers/src/compilers/zksolc/settings.rs @@ -36,6 +36,16 @@ pub enum ZkSolcWarning { TxOrigin, } +impl FromStr for ZkSolcWarning { + type Err = String; + fn from_str(s: &str) -> Result { + match s { + "txorigin" => Ok(Self::TxOrigin), + s => Err(format!("Unknown zksolc warning: {s}")), + } + } +} + /// `zksolc` errors that can be suppressed. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] @@ -46,6 +56,16 @@ pub enum ZkSolcError { SendTransfer, } +impl FromStr for ZkSolcError { + type Err = String; + fn from_str(s: &str) -> Result { + match s { + "sendtransfer" => Ok(Self::SendTransfer), + s => Err(format!("Unknown zksolc error: {s}")), + } + } +} + /// zksolc standard json input settings. See: /// https://docs.zksync.io/zk-stack/components/compiler/toolchain/solidity.html#standard-json for differences #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]