Skip to content

Commit d91c748

Browse files
Dont allow to query receipts by nonce if address is not provided
1 parent 25ad0f6 commit d91c748

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

aggregation_mode/batcher/src/db.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,7 @@ impl Db {
9494
.fetch_all(&self.pool)
9595
.await
9696
}
97-
(None, Some(n)) => {
98-
sqlx::query_as::<_, Receipt>(
99-
"SELECT status,merkle_path,nonce,address FROM tasks
100-
WHERE nonce = $1
101-
LIMIT $2",
102-
)
103-
.bind(n)
104-
.bind(limit)
105-
.fetch_all(&self.pool)
106-
.await
107-
}
108-
(None, None) => {
97+
_ => {
10998
sqlx::query_as::<_, Receipt>(
11099
"SELECT status,merkle_path,nonce,address FROM tasks
111100
LIMIT $1",

aggregation_mode/batcher/src/server/http.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ impl BatcherServer {
186186

187187
let state = state.get_ref();
188188

189+
if params.address.is_none() && params.nonce.is_some() {
190+
return HttpResponse::BadRequest().json(AppResponse::new_unsucessfull(
191+
"Bad request: Cannot specify nonce without address",
192+
400,
193+
));
194+
}
195+
189196
// TODO: maybe also accept proof commitment in query param
190197
let db_result = state
191198
.db

0 commit comments

Comments
 (0)