@@ -4,8 +4,7 @@ use crate::{
44 core:: {
55 errors,
66 types:: {
7- AlignedVerificationData , BatchInclusionData , Network , VerificationCommitmentBatch ,
8- VerificationDataCommitment ,
7+ AlignedVerificationData , BatchInclusionData , Network , VerificationCommitmentBatch , VerificationDataCommitment
98 } ,
109 } ,
1110 sdk:: is_proof_verified,
@@ -14,26 +13,27 @@ use crate::{
1413const RETRIES : u64 = 10 ;
1514const TIME_BETWEEN_RETRIES : u64 = 10 ;
1615
17- pub fn handle_batch_inclusion_data (
16+ pub fn process_batcher_response (
1817 batch_inclusion_data : BatchInclusionData ,
19- aligned_verification_data : & mut Vec < AlignedVerificationData > ,
2018 verification_data_commitment : VerificationDataCommitment ,
21- ) -> Result < ( ) , errors:: SubmitError > {
19+ ) -> Result < AlignedVerificationData , errors:: SubmitError > {
2220 debug ! ( "Received response from batcher" ) ;
2321 debug ! (
2422 "Batch merkle root: {}" ,
2523 hex:: encode( batch_inclusion_data. batch_merkle_root)
2624 ) ;
2725 debug ! ( "Index in batch: {}" , batch_inclusion_data. index_in_batch) ;
2826
29- if verify_response ( & verification_data_commitment, & batch_inclusion_data) {
30- aligned_verification_data. push ( AlignedVerificationData :: new (
31- & verification_data_commitment,
32- & batch_inclusion_data,
33- ) ) ;
27+ if verify_proof_inclusion ( & verification_data_commitment, & batch_inclusion_data) {
28+ Ok (
29+ AlignedVerificationData :: new (
30+ & verification_data_commitment,
31+ & batch_inclusion_data,
32+ )
33+ )
34+ } else {
35+ Err ( errors:: SubmitError :: InvalidProofInclusionData )
3436 }
35-
36- Ok ( ( ) )
3737}
3838
3939pub async fn await_batch_verification (
@@ -60,7 +60,7 @@ pub async fn await_batch_verification(
6060 } )
6161}
6262
63- fn verify_response (
63+ fn verify_proof_inclusion (
6464 verification_data_commitment : & VerificationDataCommitment ,
6565 batch_inclusion_data : & BatchInclusionData ,
6666) -> bool {
0 commit comments