File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
aggregation_mode/batcher/src Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1- use sqlx:: { postgres:: PgPoolOptions , Pool , Postgres } ;
1+ use sqlx:: { postgres:: PgPoolOptions , types :: Uuid , Pool , Postgres } ;
22
33#[ derive( Clone , Debug ) ]
44pub struct Db {
@@ -33,7 +33,7 @@ impl Db {
3333
3434 pub async fn get_merkle_path_by_proof_id (
3535 & self ,
36- proof_id : & str ,
36+ proof_id : Uuid ,
3737 ) -> Result < Option < Vec < u8 > > , sqlx:: Error > {
3838 sqlx:: query_scalar :: < _ , Option < Vec < u8 > > > (
3939 "SELECT merkle_path FROM proofs WHERE proof_id = $1" ,
Original file line number Diff line number Diff line change @@ -97,7 +97,12 @@ impl BatcherServer {
9797 ) ) ;
9898 }
9999
100- let db_result = state. db . get_merkle_path_by_proof_id ( & id) . await ;
100+ let Ok ( proof_id) = sqlx:: types:: Uuid :: parse_str ( & id) else {
101+ return HttpResponse :: BadRequest ( )
102+ . json ( AppResponse :: new_unsucessfull ( "Proof id invalid uuid" , 400 ) ) ;
103+ } ;
104+
105+ let db_result = state. db . get_merkle_path_by_proof_id ( proof_id) . await ;
101106 let merkle_path = match db_result {
102107 Ok ( Some ( merkle_path) ) => merkle_path,
103108 Ok ( None ) => {
@@ -106,9 +111,9 @@ impl BatcherServer {
106111 404 ,
107112 ) )
108113 }
109- Err ( _ ) => {
114+ Err ( s ) => {
110115 return HttpResponse :: InternalServerError ( )
111- . json ( AppResponse :: new_unsucessfull ( "Internal server error" , 500 ) )
116+ . json ( AppResponse :: new_unsucessfull ( "Internal server error" , 500 ) ) ;
112117 }
113118 } ;
114119
You can’t perform that action at this time.
0 commit comments