Skip to content

Commit b08b050

Browse files
committed
Fmt
1 parent 267ea7e commit b08b050

1 file changed

Lines changed: 23 additions & 17 deletions

File tree

  • batcher/aligned-batcher/src

batcher/aligned-batcher/src/lib.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,24 @@ impl Batcher {
570570
return Ok(());
571571
}
572572

573-
if !self.msg_batcher_payment_addr_is_valid(&client_msg, &ws_conn_sink).await {
573+
if !self
574+
.msg_batcher_payment_addr_is_valid(&client_msg, &ws_conn_sink)
575+
.await
576+
{
574577
return Ok(());
575578
}
576579

577-
if !self.msg_proof_size_is_valid(&client_msg, &ws_conn_sink).await {
580+
if !self
581+
.msg_proof_size_is_valid(&client_msg, &ws_conn_sink)
582+
.await
583+
{
578584
return Ok(());
579585
}
580586

581-
let Some(addr) = self.msg_signature_is_valid(&client_msg, &ws_conn_sink).await else {
587+
let Some(addr) = self
588+
.msg_signature_is_valid(&client_msg, &ws_conn_sink)
589+
.await
590+
else {
582591
return Ok(());
583592
};
584593

@@ -640,7 +649,6 @@ impl Batcher {
640649
return Ok(());
641650
}
642651

643-
644652
// We acquire the lock first only to query if the user is already present and the lock is dropped.
645653
// If it was not present, then the user nonce is queried to the Aligned contract.
646654
// Lastly, we get a lock of the batch state again and insert the user state if it was still missing.
@@ -1855,9 +1863,9 @@ impl Batcher {
18551863
+ BATCHER_SUBMISSION_BASE_GAS_COST
18561864
}
18571865

1858-
/// Checks if the message signature is valid
1859-
/// and returns the address if its.
1860-
/// If not, returns false, logs the error,
1866+
/// Checks if the message signature is valid
1867+
/// and returns the address if its.
1868+
/// If not, returns false, logs the error,
18611869
/// and sends it to the metrics server
18621870
async fn msg_signature_is_valid(
18631871
&self,
@@ -1874,19 +1882,18 @@ impl Batcher {
18741882
self.metrics.user_error(&["invalid_signature", ""]);
18751883
return None;
18761884
};
1877-
1885+
18781886
Some(addr)
18791887
}
18801888

18811889
/// Checks if the proof size + pub inputs is valid (not exceeding max_proof_size)
1882-
/// Returns false, logs the error,
1890+
/// Returns false, logs the error,
18831891
/// and sends it to the metrics server if the size is too large
18841892
async fn msg_proof_size_is_valid(
18851893
&self,
18861894
client_msg: &SubmitProofMessage,
18871895
ws_conn_sink: &WsMessageSink,
18881896
) -> bool {
1889-
18901897
let verification_data = match cbor_serialize(&client_msg.verification_data) {
18911898
Ok(data) => data,
18921899
// This should never happened, the user sent all his data serialized
@@ -1912,13 +1919,12 @@ impl Batcher {
19121919
self.metrics.user_error(&["proof_too_large", ""]);
19131920
return false;
19141921
}
1915-
1922+
19161923
true
19171924
}
19181925

1919-
19201926
/// Checks if the chain id matches the one in the config
1921-
/// Returns false, logs the error,
1927+
/// Returns false, logs the error,
19221928
/// and sends it to the metrics server if it doesn't matches
19231929
async fn msg_chain_id_is_valid(
19241930
&self,
@@ -1936,12 +1942,12 @@ impl Batcher {
19361942
self.metrics.user_error(&["invalid_chain_id", ""]);
19371943
return false;
19381944
}
1939-
1945+
19401946
true
19411947
}
19421948

19431949
/// Checks if the message has a valid payment service address
1944-
/// Returns false, logs the error,
1950+
/// Returns false, logs the error,
19451951
/// and sends it to the metrics server if it doesn't match
19461952
async fn msg_batcher_payment_addr_is_valid(
19471953
&self,
@@ -1963,7 +1969,7 @@ impl Batcher {
19631969
.user_error(&["invalid_payment_service_address", ""]);
19641970
return false;
19651971
}
1966-
1972+
19671973
true
19681974
}
19691975

@@ -1984,7 +1990,7 @@ impl Batcher {
19841990
self.metrics.user_error(&["insufficient_balance", ""]);
19851991
return false;
19861992
}
1987-
1993+
19881994
true
19891995
}
19901996
}

0 commit comments

Comments
 (0)