@@ -103,11 +103,7 @@ impl BatchState {
103103 self . batch_queue
104104 . iter ( )
105105 . map ( |( entry, _) | entry)
106- . find ( |entry| {
107- entry. sender == sender
108- && U256 :: from_big_endian ( entry. nonced_verification_data . nonce . as_slice ( ) )
109- == nonce
110- } )
106+ . find ( |entry| entry. sender == sender && entry. nonced_verification_data . nonce == nonce)
111107 }
112108
113109 /// Checks if the entry is valid
@@ -122,8 +118,7 @@ impl BatchState {
122118 replacement_entry : BatchQueueEntry ,
123119 ) -> Option < ValidityResponseMessage > {
124120 let replacement_max_fee = replacement_entry. nonced_verification_data . max_fee ;
125- let nonce =
126- U256 :: from_big_endian ( replacement_entry. nonced_verification_data . nonce . as_slice ( ) ) ;
121+ let nonce = replacement_entry. nonced_verification_data . nonce ;
127122 let sender = replacement_entry. sender ;
128123
129124 debug ! (
@@ -134,7 +129,7 @@ impl BatchState {
134129 // it is a valid entry only if there is no entry with the same sender, lower nonce and a lower fee
135130 let is_valid = !self . batch_queue . iter ( ) . any ( |( entry, _) | {
136131 entry. sender == sender
137- && U256 :: from_big_endian ( entry. nonced_verification_data . nonce . as_slice ( ) ) < nonce
132+ && entry. nonced_verification_data . nonce < nonce
138133 && entry. nonced_verification_data . max_fee < replacement_max_fee
139134 } ) ;
140135
@@ -439,7 +434,7 @@ impl Batcher {
439434
440435 info ! (
441436 "Received message with nonce: {}" ,
442- U256 :: from_big_endian ( client_msg. verification_data. nonce. as_slice ( ) )
437+ client_msg. verification_data. nonce
443438 ) ;
444439
445440 if client_msg. verification_data . chain_id != self . chain_id {
@@ -495,7 +490,7 @@ impl Batcher {
495490 }
496491
497492 // Nonce and max fee verification
498- let nonce = U256 :: from_big_endian ( nonced_verification_data. nonce . as_slice ( ) ) ;
493+ let nonce = nonced_verification_data. nonce ;
499494 let max_fee = nonced_verification_data. max_fee ;
500495
501496 if max_fee < U256 :: from ( MIN_FEE_PER_PROOF ) {
@@ -644,7 +639,7 @@ impl Batcher {
644639 return false ;
645640 }
646641
647- let nonce = U256 :: from_big_endian ( & nonced_verification_data. nonce ) ;
642+ let nonce = nonced_verification_data. nonce ;
648643
649644 batch_state. user_nonces . insert ( addr, nonce + U256 :: one ( ) ) ;
650645 batch_state. user_min_fee . insert ( addr, max_fee) ;
@@ -678,7 +673,7 @@ impl Batcher {
678673 expected_user_nonce : U256 ,
679674 ) -> bool {
680675 let replacement_max_fee = nonced_verification_data. max_fee ;
681- let nonce = U256 :: from_big_endian ( & nonced_verification_data. nonce ) ;
676+ let nonce = nonced_verification_data. nonce ;
682677
683678 let mut replacement_entry = match batch_state. get_entry ( addr, nonce) {
684679 Some ( entry) => {
@@ -761,7 +756,7 @@ impl Batcher {
761756 info ! ( "Adding verification data to batch..." ) ;
762757
763758 let max_fee = verification_data. max_fee ;
764- let nonce = U256 :: from_big_endian ( verification_data. nonce . as_slice ( ) ) ;
759+ let nonce = verification_data. nonce ;
765760
766761 batch_state. batch_queue . push (
767762 BatchQueueEntry :: new (
@@ -1254,24 +1249,26 @@ impl Batcher {
12541249 }
12551250 } ;
12561251
1257- debug ! ( "non paying nonce: {:?}" , nonpaying_nonce) ;
1252+ info ! ( "non paying nonce: {:?}" , nonpaying_nonce) ;
1253+
1254+ let nonce_value = * nonpaying_nonce;
12581255
1259- let mut nonce_bytes = [ 0u8 ; 32 ] ;
1260- nonpaying_nonce. to_big_endian ( & mut nonce_bytes) ;
12611256 * nonpaying_nonce += U256 :: one ( ) ;
12621257
12631258 NoncedVerificationData :: new (
12641259 client_msg. verification_data . verification_data . clone ( ) ,
1265- nonce_bytes ,
1260+ nonce_value ,
12661261 DEFAULT_MAX_FEE_PER_PROOF . into ( ) , // 13_000 gas per proof * 100 gwei gas price (upper bound)
12671262 self . chain_id ,
1263+ self . payment_service . address ( ) ,
12681264 )
12691265 } ;
12701266
12711267 let client_msg = ClientMessage :: new (
12721268 nonced_verification_data. clone ( ) ,
12731269 non_paying_config. replacement . clone ( ) ,
1274- ) ;
1270+ )
1271+ . await ;
12751272
12761273 let batch_state = self . batch_state . lock ( ) . await ;
12771274 self . clone ( )
0 commit comments