File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed
Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,9 @@ impl Batcher {
327327
328328 pub async fn listen_connections ( self : Arc < Self > , address : & str ) -> Result < ( ) , BatcherError > {
329329 // Create the event loop and TCP listener we'll accept connections on.
330- let listener = TcpListener :: bind ( address) . await . expect ( "Failed to build" ) ;
330+ let listener = TcpListener :: bind ( address)
331+ . await
332+ . map_err ( |e| BatcherError :: TcpListenerError ( e. to_string ( ) ) ) ?;
331333 info ! ( "Listening on: {}" , address) ;
332334
333335 // Let's spawn the handling of each connection in a separate task.
Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ async fn main() -> Result<(), BatcherError> {
4646 // spawn task to listening for incoming blocks
4747 tokio:: spawn ( {
4848 let app = batcher. clone ( ) ;
49- async move { app. listen_new_blocks ( ) . await . unwrap ( ) }
49+ async move {
50+ app. listen_new_blocks ( )
51+ . await
52+ . expect ( "Error listening for new blocks exiting" )
53+ }
5054 } ) ;
5155
5256 batcher. listen_connections ( & addr) . await ?;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use ethers::types::SignatureError;
44use tokio_tungstenite:: tungstenite;
55
66pub enum BatcherError {
7+ TcpListenerError ( String ) ,
78 ConnectionError ( tungstenite:: Error ) ,
89 BatchVerifiedEventStreamError ( String ) ,
910 EthereumSubscriptionError ( String ) ,
@@ -33,6 +34,9 @@ impl From<SignatureError> for BatcherError {
3334impl fmt:: Debug for BatcherError {
3435 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
3536 match self {
37+ BatcherError :: TcpListenerError ( e) => {
38+ write ! ( f, "TCP Listener error: {}" , e)
39+ }
3640 BatcherError :: ConnectionError ( e) => {
3741 write ! ( f, "Web Socket Connection error: {}" , e)
3842 }
Original file line number Diff line number Diff line change @@ -307,7 +307,16 @@ async fn main() -> Result<(), AlignedError> {
307307 . map_err ( |e| SubmitError :: GenericError ( e. to_string ( ) ) ) ?
308308 } else {
309309 warn ! ( "Missing keystore used for payment. This proof will not be included if sent to Eth Mainnet" ) ;
310- LocalWallet :: from_str ( ANVIL_PRIVATE_KEY ) . expect ( "Failed to create wallet" )
310+ match LocalWallet :: from_str ( ANVIL_PRIVATE_KEY ) {
311+ Ok ( wallet) => wallet,
312+ Err ( e) => {
313+ warn ! (
314+ "Failed to create wallet from anvil private key: {}" ,
315+ e. to_string( )
316+ ) ;
317+ return Ok ( ( ) ) ;
318+ }
319+ }
311320 } ;
312321
313322 let eth_rpc_url = submit_args. eth_rpc_url . clone ( ) ;
You can’t perform that action at this time.
0 commit comments