@@ -14,7 +14,7 @@ use aligned_sdk::core::{
1414} ;
1515use aligned_sdk:: sdk:: get_chain_id;
1616use aligned_sdk:: sdk:: get_next_nonce;
17- use aligned_sdk:: sdk:: { get_commitment , is_proof_verified, submit_multiple} ;
17+ use aligned_sdk:: sdk:: { get_vk_commitment , is_proof_verified, submit_multiple} ;
1818use clap:: Parser ;
1919use clap:: Subcommand ;
2020use clap:: ValueEnum ;
@@ -28,8 +28,8 @@ use log::{error, info};
2828use transaction:: eip2718:: TypedTransaction ;
2929
3030use crate :: AlignedCommands :: DepositToBatcher ;
31- use crate :: AlignedCommands :: GetCommitment ;
3231use crate :: AlignedCommands :: GetUserBalance ;
32+ use crate :: AlignedCommands :: GetVkCommitment ;
3333use crate :: AlignedCommands :: Submit ;
3434use crate :: AlignedCommands :: VerifyProofOnchain ;
3535
@@ -47,10 +47,8 @@ pub enum AlignedCommands {
4747 Submit ( SubmitArgs ) ,
4848 #[ clap( about = "Verify the proof was included in a verified batch on Ethereum" ) ]
4949 VerifyProofOnchain ( VerifyProofOnchainArgs ) ,
50-
51- // Get commitment for file, command name is get-commitment
52- #[ clap( about = "Get commitment for file" , name = "get-commitment" ) ]
53- GetCommitment ( GetCommitmentArgs ) ,
50+ #[ clap( about = "Get commitment for file" , name = "get-vk-commitment" ) ]
51+ GetVkCommitment ( GetVkCommitmentArgs ) ,
5452 #[ clap(
5553 about = "Deposits Ethereum in the batcher to pay for proofs" ,
5654 name = "deposit-to-batcher"
@@ -187,9 +185,11 @@ pub struct VerifyProofOnchainArgs {
187185
188186#[ derive( Parser , Debug ) ]
189187#[ command( version, about, long_about = None ) ]
190- pub struct GetCommitmentArgs {
191- #[ arg( name = "File name" , long = "input" ) ]
192- input_file : PathBuf ,
188+ pub struct GetVkCommitmentArgs {
189+ #[ arg( name = "Verification key file path" , long = "verification_key_file" ) ]
190+ verification_key_file : PathBuf ,
191+ #[ arg( name = "Proving system" , long = "proving_system" ) ]
192+ proving_system : ProvingSystemArg ,
193193 #[ arg( name = "Output file" , long = "output" ) ]
194194 output_file : Option < PathBuf > ,
195195}
@@ -409,17 +409,18 @@ async fn main() -> Result<(), AlignedError> {
409409 info ! ( "Your proof was not included in the batch." ) ;
410410 }
411411 }
412- GetCommitment ( args) => {
413- let content = read_file ( args. input_file ) ?;
412+ GetVkCommitment ( args) => {
413+ let verification_key_bytes = read_file ( args. verification_key_file ) ?;
414+ let proving_system = args. proving_system . into ( ) ;
414415
415- let hash = get_commitment ( & content ) ;
416+ let vk_commitment = get_vk_commitment ( & verification_key_bytes , proving_system ) ;
416417
417- info ! ( "Commitment: {}" , hex:: encode( hash ) ) ;
418+ info ! ( "Commitment: {}" , hex:: encode( vk_commitment ) ) ;
418419 if let Some ( output_file) = args. output_file {
419420 let mut file = File :: create ( output_file. clone ( ) )
420421 . map_err ( |e| SubmitError :: IoError ( output_file. clone ( ) , e) ) ?;
421422
422- file. write_all ( hex:: encode ( hash ) . as_bytes ( ) )
423+ file. write_all ( hex:: encode ( vk_commitment ) . as_bytes ( ) )
423424 . map_err ( |e| SubmitError :: IoError ( output_file. clone ( ) , e) ) ?;
424425 }
425426 }
0 commit comments