@@ -128,87 +128,87 @@ async fn handle_batcher_response(msg: Message) -> Result<BatchInclusionData, Sub
128128 match cbor_deserialize ( data. as_slice ( ) ) {
129129 Ok ( ResponseMessage :: BatchInclusionData ( batch_inclusion_data) ) => {
130130 //OK case. Proofs was valid and it was included in this batch.
131- return Ok ( batch_inclusion_data) ;
131+ Ok ( batch_inclusion_data)
132132 }
133133 Ok ( ResponseMessage :: InvalidNonce ) => {
134134 error ! ( "Batcher responded with invalid nonce" ) ;
135- return Err ( SubmitError :: InvalidNonce ) ;
135+ Err ( SubmitError :: InvalidNonce )
136136 }
137137 Ok ( ResponseMessage :: InvalidSignature ) => {
138138 error ! ( "Batcher responded with invalid signature" ) ;
139- return Err ( SubmitError :: InvalidSignature ) ;
139+ Err ( SubmitError :: InvalidSignature )
140140 }
141141 Ok ( ResponseMessage :: ProofTooLarge ) => {
142142 error ! ( "Batcher responded with proof too large" ) ;
143- return Err ( SubmitError :: ProofTooLarge ) ;
143+ Err ( SubmitError :: ProofTooLarge )
144144 }
145145 Ok ( ResponseMessage :: InvalidMaxFee ) => {
146146 error ! ( "Batcher responded with invalid max fee" ) ;
147- return Err ( SubmitError :: InvalidMaxFee ) ;
147+ Err ( SubmitError :: InvalidMaxFee )
148148 }
149149 Ok ( ResponseMessage :: InsufficientBalance ( addr) ) => {
150150 error ! ( "Batcher responded with insufficient balance" ) ;
151- return Err ( SubmitError :: InsufficientBalance ( addr) ) ;
151+ Err ( SubmitError :: InsufficientBalance ( addr) )
152152 }
153153 Ok ( ResponseMessage :: InvalidChainId ) => {
154154 error ! ( "Batcher responded with invalid chain id" ) ;
155- return Err ( SubmitError :: InvalidChainId ) ;
155+ Err ( SubmitError :: InvalidChainId )
156156 }
157157 Ok ( ResponseMessage :: InvalidReplacementMessage ) => {
158158 error ! ( "Batcher responded with invalid replacement message" ) ;
159- return Err ( SubmitError :: InvalidReplacementMessage ) ;
159+ Err ( SubmitError :: InvalidReplacementMessage )
160160 }
161161 Ok ( ResponseMessage :: AddToBatchError ) => {
162162 error ! ( "Batcher responded with add to batch error" ) ;
163- return Err ( SubmitError :: AddToBatchError ) ;
163+ Err ( SubmitError :: AddToBatchError )
164164 }
165165 Ok ( ResponseMessage :: EthRpcError ) => {
166166 error ! ( "Batcher experienced Eth RPC connection error" ) ;
167- return Err ( SubmitError :: EthereumProviderError (
167+ Err ( SubmitError :: EthereumProviderError (
168168 "Batcher experienced Eth RPC connection error" . to_string ( ) ,
169- ) ) ;
169+ ) )
170170 }
171171 Ok ( ResponseMessage :: InvalidPaymentServiceAddress ( received_addr, expected_addr) ) => {
172172 error ! (
173173 "Batcher responded with invalid payment service address: {:?}, expected: {:?}" ,
174174 received_addr, expected_addr
175175 ) ;
176- return Err ( SubmitError :: InvalidPaymentServiceAddress (
176+ Err ( SubmitError :: InvalidPaymentServiceAddress (
177177 received_addr,
178178 expected_addr,
179- ) ) ;
179+ ) )
180180 }
181181 Ok ( ResponseMessage :: InvalidProof ( reason) ) => {
182182 error ! ( "Batcher responded with invalid proof: {}" , reason) ;
183- return Err ( SubmitError :: InvalidProof ( reason) ) ;
183+ Err ( SubmitError :: InvalidProof ( reason) )
184184 }
185185 Ok ( ResponseMessage :: CreateNewTaskError ( merkle_root, error) ) => {
186186 error ! ( "Batcher responded with create new task error: {}" , error) ;
187- return Err ( SubmitError :: BatchSubmissionFailed (
187+ Err ( SubmitError :: BatchSubmissionFailed (
188188 "Could not create task with merkle root " . to_owned ( )
189189 + & merkle_root
190190 + ", failed with error: "
191191 + & error,
192- ) ) ;
192+ ) )
193193 }
194194 Ok ( ResponseMessage :: ProtocolVersion ( _) ) => {
195195 error ! ( "Batcher responded with protocol version instead of batch inclusion data" ) ;
196- return Err ( SubmitError :: UnexpectedBatcherResponse (
196+ Err ( SubmitError :: UnexpectedBatcherResponse (
197197 "Batcher responded with protocol version instead of batch inclusion data"
198198 . to_string ( ) ,
199- ) ) ;
199+ ) )
200200 }
201201 Ok ( ResponseMessage :: BatchReset ) => {
202202 error ! ( "Batcher responded with batch reset" ) ;
203- return Err ( SubmitError :: ProofQueueFlushed ) ;
203+ Err ( SubmitError :: ProofQueueFlushed )
204204 }
205205 Ok ( ResponseMessage :: Error ( e) ) => {
206206 error ! ( "Batcher responded with error: {}" , e) ;
207- return Err ( SubmitError :: GenericError ( e) ) ;
207+ Err ( SubmitError :: GenericError ( e) )
208208 }
209209 Err ( e) => {
210210 error ! ( "Error while deserializing batch inclusion data: {}" , e) ;
211- return Err ( SubmitError :: SerializationError ( e) ) ;
211+ Err ( SubmitError :: SerializationError ( e) )
212212 }
213213 }
214214}
@@ -241,7 +241,7 @@ fn match_batcher_response_with_stored_verification_data(
241241// Returns the biggest nonce from the sent verification data
242242// Used to know which is the last proof sent to the Batcher,
243243// to know when to stop reading the WS for responses
244- fn get_biggest_nonce ( sent_verification_data : & Vec < NoncedVerificationData > ) -> U256 {
244+ fn get_biggest_nonce ( sent_verification_data : & [ NoncedVerificationData ] ) -> U256 {
245245 let mut biggest_nonce = U256 :: zero ( ) ;
246246 for verification_data in sent_verification_data. iter ( ) {
247247 if verification_data. nonce > biggest_nonce {
0 commit comments