diff --git a/bin/withdrawal-finalizer/src/config.rs b/bin/withdrawal-finalizer/src/config.rs index 617ea545..5f83bccb 100644 --- a/bin/withdrawal-finalizer/src/config.rs +++ b/bin/withdrawal-finalizer/src/config.rs @@ -14,6 +14,10 @@ pub struct Config { #[envconfig(from = "ETH_CLIENT_WS_URL")] pub eth_client_ws_url: Url, + /// L1 HTTP url. + #[envconfig(from = "ETH_CLIENT_HTTP_URL")] + pub eth_client_http_url: Url, + /// Address of the `L1Bridge` contract. #[envconfig(from = "CONTRACTS_L1_ERC20_BRIDGE_PROXY_ADDR")] pub l1_erc20_bridge_proxy_addr: Address, @@ -34,6 +38,10 @@ pub struct Config { #[envconfig(from = "API_WEB3_JSON_RPC_WS_URL")] pub api_web3_json_rpc_ws_url: Url, + /// L2 HTTP Endpoint + #[envconfig(from = "API_WEB3_JSON_RPC_HTTP_URL")] + pub api_web3_json_rpc_http_url: Url, + #[envconfig(from = "DATABASE_URL")] pub database_url: Url, diff --git a/bin/withdrawal-finalizer/src/main.rs b/bin/withdrawal-finalizer/src/main.rs index 89e5a4f1..1fb60c60 100644 --- a/bin/withdrawal-finalizer/src/main.rs +++ b/bin/withdrawal-finalizer/src/main.rs @@ -10,7 +10,7 @@ use std::{str::FromStr, sync::Arc, time::Duration}; use envconfig::Envconfig; use ethers::{ prelude::SignerMiddleware, - providers::{JsonRpcClient, Middleware, Provider, Ws}, + providers::{Http, JsonRpcClient, Middleware, Provider}, signers::LocalWallet, types::U256, }; @@ -165,18 +165,11 @@ async fn main() -> Result<()> { // `ethers-rs`. In the logic of reconnections have to happen as long // as the application exists; below code configures that number to // be `usize::MAX` as such. - let provider_l1 = - Provider::::connect_with_reconnects(config.eth_client_ws_url.as_ref(), usize::MAX) - .await - .unwrap(); + let provider_l1 = Provider::::try_from(config.eth_client_http_url.as_ref()).unwrap(); let client_l1 = Arc::new(provider_l1); - let provider_l2 = Provider::::connect_with_reconnects( - config.api_web3_json_rpc_ws_url.as_str(), - usize::MAX, - ) - .await - .unwrap(); + let provider_l2 = + Provider::::try_from(config.api_web3_json_rpc_http_url.as_str()).unwrap(); let client_l2 = Arc::new(provider_l2); @@ -285,16 +278,6 @@ async fn main() -> Result<()> { config.tx_retry_timeout, finalizer_account_address, ); - - let provider_l2 = Provider::::connect_with_reconnects( - config.api_web3_json_rpc_ws_url.as_str(), - usize::MAX, - ) - .await - .unwrap(); - - let client_l2 = Arc::new(provider_l2); - let finalizer_handle = tokio::spawn(finalizer.run(client_l2)); tokio::select! {