@@ -23,18 +23,16 @@ use tokio_tungstenite::connect_async;
2323use tokio_tungstenite:: tungstenite:: Message ;
2424use tokio_tungstenite:: { MaybeTlsStream , WebSocketStream } ;
2525
26- use aligned_batcher_lib:: types:: {
27- parse_proving_system, BatchInclusionData , ProvingSystemId , VerificationData ,
28- } ;
26+ use aligned_batcher_lib:: types:: { BatchInclusionData , ProvingSystemId , VerificationData } ;
2927use clap:: Subcommand ;
3028use ethers:: utils:: hex;
3129use sha3:: { Digest , Keccak256 } ;
3230
3331use crate :: errors:: BatcherClientError ;
3432use crate :: types:: AlignedVerificationData ;
33+ use crate :: AlignedCommands :: GetVerificationKeyCommitment ;
3534use crate :: AlignedCommands :: Submit ;
3635use crate :: AlignedCommands :: VerifyProofOnchain ;
37- use crate :: AlignedCommands :: GetVerificationKeyCommitment ;
3836
3937use clap:: { Parser , ValueEnum } ;
4038
@@ -53,7 +51,10 @@ pub enum AlignedCommands {
5351 VerifyProofOnchain ( VerifyProofOnchainArgs ) ,
5452
5553 // GetVericiationKey, command name is get-vk-commitment
56- #[ clap( about = "Create verification key for proving system" , name = "get-vk-commitment" ) ]
54+ #[ clap(
55+ about = "Create verification key for proving system" ,
56+ name = "get-vk-commitment"
57+ ) ]
5758 GetVerificationKeyCommitment ( GetVerificationKeyCommitmentArgs ) ,
5859}
5960
@@ -67,7 +68,7 @@ pub struct SubmitArgs {
6768 ) ]
6869 connect_addr : String ,
6970 #[ arg( name = "Proving system" , long = "proving_system" ) ]
70- proving_system_flag : String ,
71+ proving_system_flag : ProvingSystemArg ,
7172 #[ arg( name = "Proof file path" , long = "proof" ) ]
7273 proof_file_name : PathBuf ,
7374 #[ arg( name = "Public input file name" , long = "public_input" ) ]
@@ -130,6 +131,38 @@ pub enum Chain {
130131 Holesky ,
131132}
132133
134+ #[ derive( Debug , Clone , ValueEnum ) ]
135+ pub enum ProvingSystemArg {
136+ #[ clap( name = "GnarkPlonkBls12_381" ) ]
137+ GnarkPlonkBls12_381 ,
138+ #[ clap( name = "GnarkPlonkBn254" ) ]
139+ GnarkPlonkBn254 ,
140+ #[ clap( name = "Groth16Bn254" ) ]
141+ Groth16Bn254 ,
142+ #[ clap( name = "SP1" ) ]
143+ SP1 ,
144+ #[ clap( name = "Halo2KZG" ) ]
145+ Halo2KZG ,
146+ #[ clap( name = "Halo2IPA" ) ]
147+ Halo2IPA ,
148+ #[ clap( name = "Risc0" ) ]
149+ Risc0 ,
150+ }
151+
152+ impl From < ProvingSystemArg > for ProvingSystemId {
153+ fn from ( proving_system : ProvingSystemArg ) -> Self {
154+ match proving_system {
155+ ProvingSystemArg :: GnarkPlonkBls12_381 => ProvingSystemId :: GnarkPlonkBls12_381 ,
156+ ProvingSystemArg :: GnarkPlonkBn254 => ProvingSystemId :: GnarkPlonkBn254 ,
157+ ProvingSystemArg :: Groth16Bn254 => ProvingSystemId :: Groth16Bn254 ,
158+ ProvingSystemArg :: SP1 => ProvingSystemId :: SP1 ,
159+ ProvingSystemArg :: Halo2KZG => ProvingSystemId :: Halo2KZG ,
160+ ProvingSystemArg :: Halo2IPA => ProvingSystemId :: Halo2IPA ,
161+ ProvingSystemArg :: Risc0 => ProvingSystemId :: Risc0 ,
162+ }
163+ }
164+ }
165+
133166#[ tokio:: main]
134167async fn main ( ) -> Result < ( ) , errors:: BatcherClientError > {
135168 env_logger:: Builder :: from_env ( Env :: default ( ) . default_filter_or ( "info" ) ) . init ( ) ;
@@ -324,8 +357,7 @@ async fn receive(
324357}
325358
326359fn verification_data_from_args ( args : SubmitArgs ) -> Result < VerificationData , BatcherClientError > {
327- let proving_system = parse_proving_system ( & args. proving_system_flag )
328- . map_err ( |_| BatcherClientError :: InvalidProvingSystem ( args. proving_system_flag ) ) ?;
360+ let proving_system = args. proving_system_flag . into ( ) ;
329361
330362 // Read proof file
331363 let proof = read_file ( args. proof_file_name ) ?;
0 commit comments