Skip to content

Commit 6af00e6

Browse files
committed
Remove checks of nonces with checks
1 parent 44c3306 commit 6af00e6

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

  • batcher/aligned-batcher/src

batcher/aligned-batcher/src/lib.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,25 +567,28 @@ impl Batcher {
567567
return Ok(());
568568
}
569569

570-
let Some(mut addr) = self
570+
let Some(addr_in_msg) = self
571571
.msg_signature_is_valid(&client_msg, &ws_conn_sink)
572572
.await
573573
else {
574574
return Ok(());
575575
};
576576

577-
let nonced_verification_data;
577+
let addr;
578578
let signature;
579+
let nonced_verification_data;
579580

580-
if self.has_to_pay(&addr) {
581-
nonced_verification_data = client_msg.verification_data.clone();
581+
if self.has_to_pay(&addr_in_msg) {
582+
addr = addr_in_msg;
582583
signature = client_msg.signature;
584+
nonced_verification_data = client_msg.verification_data.clone();
583585
} else {
584586
info!("Generating non-paying data");
585587
let non_paying_data = self.generate_non_paying_data(&client_msg).await;
588+
// If the user is not required to pay, substitute their address with a pre-funded Aligned address
586589
addr = non_paying_data.address;
587-
nonced_verification_data = non_paying_data.nonced_verification_data;
588590
signature = non_paying_data.signature;
591+
nonced_verification_data = non_paying_data.nonced_verification_data;
589592
}
590593

591594
// When pre-verification is enabled, batcher will verify proofs for faster feedback with clients
@@ -729,7 +732,7 @@ impl Batcher {
729732
return Ok(());
730733
}
731734

732-
if self.has_to_pay(&addr) {
735+
if self.has_to_pay(&addr_in_msg) {
733736
let cached_user_nonce = batch_state_lock.get_user_nonce(&addr).await;
734737

735738
let Some(expected_nonce) = cached_user_nonce else {

0 commit comments

Comments
 (0)