diff --git a/crates/cli/src/opts/build/zksync.rs b/crates/cli/src/opts/build/zksync.rs index d6a0e1c2b..216a37da6 100644 --- a/crates/cli/src/opts/build/zksync.rs +++ b/crates/cli/src/opts/build/zksync.rs @@ -1,6 +1,6 @@ use std::{collections::HashSet, path::PathBuf}; -use alloy_primitives::{Address, Bytes}; +use alloy_primitives::{hex, Address, Bytes}; use clap::Parser; use foundry_compilers::zksolc::settings::{ZkSolcError, ZkSolcWarning}; use foundry_config::ZkSyncConfig; @@ -115,7 +115,8 @@ pub struct ZkSyncArgs { #[clap( long = "zk-paymaster-input", value_name = "PAYMASTER_INPUT", - visible_alias = "paymaster-input" + visible_alias = "paymaster-input", + value_parser = parse_hex_bytes )] pub paymaster_input: Option, @@ -185,3 +186,7 @@ impl ZkSyncArgs { zksync } } + +fn parse_hex_bytes(s: &str) -> Result { + hex::decode(s).map(Bytes::from).map_err(|e| format!("Invalid hex string: {e}")) +}