Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: everything but subscriptions is now http #186

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/withdrawal-finalizer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,

Expand Down
25 changes: 4 additions & 21 deletions bin/withdrawal-finalizer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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::<Ws>::connect_with_reconnects(config.eth_client_ws_url.as_ref(), usize::MAX)
.await
.unwrap();
let provider_l1 = Provider::<Http>::try_from(config.eth_client_http_url.as_ref()).unwrap();
let client_l1 = Arc::new(provider_l1);

let provider_l2 = Provider::<Ws>::connect_with_reconnects(
config.api_web3_json_rpc_ws_url.as_str(),
usize::MAX,
)
.await
.unwrap();
let provider_l2 =
Provider::<Http>::try_from(config.api_web3_json_rpc_http_url.as_str()).unwrap();

let client_l2 = Arc::new(provider_l2);

Expand Down Expand Up @@ -285,16 +278,6 @@ async fn main() -> Result<()> {
config.tx_retry_timeout,
finalizer_account_address,
);

let provider_l2 = Provider::<Ws>::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! {
Expand Down
Loading