diff --git a/crates/settlement-clients/ethereum/src/lib.rs b/crates/settlement-clients/ethereum/src/lib.rs index 431fbfea..f310111c 100644 --- a/crates/settlement-clients/ethereum/src/lib.rs +++ b/crates/settlement-clients/ethereum/src/lib.rs @@ -50,12 +50,8 @@ pub mod conversion; mod tests; pub mod types; -#[cfg(test)] use {alloy::providers::RootProvider, alloy::transports::http::Http, reqwest::Client}; -#[cfg(not(test))] -use types::EthHttpProvider; - pub const ENV_PRIVATE_KEY: &str = "ETHEREUM_PRIVATE_KEY"; lazy_static! { @@ -71,14 +67,10 @@ pub struct EthereumSettlementClient { core_contract_client: StarknetValidityContractClient, wallet: EthereumWallet, wallet_address: Address, - #[cfg(not(test))] - provider: Arc, - #[cfg(test)] provider: RootProvider>, } impl EthereumSettlementClient { - #[cfg(not(test))] pub fn with_settings(settings: &impl SettingsProvider) -> Self { let settlement_cfg: EthereumSettlementConfig = settings.get_settings(SETTLEMENT_SETTINGS_NAME).unwrap(); @@ -87,15 +79,19 @@ impl EthereumSettlementClient { let wallet_address = signer.address(); let wallet = EthereumWallet::from(signer); - let provider = Arc::new( - ProviderBuilder::new().with_recommended_fillers().wallet(wallet.clone()).on_http(settlement_cfg.rpc_url), + let fill_provider = Arc::new( + ProviderBuilder::new() + .with_recommended_fillers() + .wallet(wallet.clone()) + .on_http(settlement_cfg.rpc_url.clone()), ); + let provider = ProviderBuilder::new().on_http(settlement_cfg.rpc_url); let core_contract_client = StarknetValidityContractClient::new( Address::from_str(&settlement_cfg.core_contract_address) .expect("Failed to convert the validity contract address.") .0 .into(), - provider.clone(), + fill_provider.clone(), ); EthereumSettlementClient { provider, core_contract_client, wallet, wallet_address } diff --git a/crates/settlement-clients/ethereum/src/tests/mod.rs b/crates/settlement-clients/ethereum/src/tests/mod.rs index d323a30f..bad1f20c 100644 --- a/crates/settlement-clients/ethereum/src/tests/mod.rs +++ b/crates/settlement-clients/ethereum/src/tests/mod.rs @@ -224,7 +224,9 @@ async fn get_last_settled_block_typical_works(#[case] fork_block_no: u64) { dotenvy::from_filename(&*ENV_FILE_PATH).expect("Could not load .env.test file."); env::set_var("DEFAULT_SETTLEMENT_CLIENT_RPC", &*ETH_RPC); - let TestSetup { anvil: _, ethereum_settlement_client, provider: _ } = setup_ethereum_test(fork_block_no); + let TestSetup { anvil, ethereum_settlement_client, provider: _ } = setup_ethereum_test(fork_block_no); + + println!("{:?}", anvil); let _ = ethereum_settlement_client.get_last_settled_block().await.expect("Could not get last settled block."); }