Skip to content

Commit

Permalink
Enable RPC retries (taikoxyz#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
intoverflow authored and CeciliaZ030 committed Feb 4, 2024
1 parent 99f2229 commit 7e9e874
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/src/host/provider/rpc_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use anyhow::{anyhow, Context, Result};
use ethers_core::types::{
Block, Bytes, EIP1186ProofResponse, Filter, Log, Transaction, H256, U256,
};
use ethers_providers::{Http, Middleware};
use anyhow::{anyhow, Result};
use ethers_core::types::{Block, Bytes, EIP1186ProofResponse, Transaction, H256, U256};
use ethers_providers::{Http, Middleware, RetryClient};
use log::info;
#[cfg(feature = "taiko")]
use zeth_primitives::taiko::BlockProposed;

use super::{AccountQuery, BlockQuery, ProofQuery, Provider, StorageQuery};

pub struct RpcProvider {
http_client: ethers_providers::Provider<Http>,
http_client: ethers_providers::Provider<RetryClient<Http>>,
tokio_handle: tokio::runtime::Handle,
}

impl RpcProvider {
pub fn new(rpc_url: String) -> Result<Self> {
let http_client = ethers_providers::Provider::<Http>::try_from(&rpc_url)?;
let http_client =
ethers_providers::Provider::<RetryClient<Http>>::new_client(&rpc_url, 3, 500)?;
let tokio_handle = tokio::runtime::Handle::current();

Ok(RpcProvider {
Expand Down

0 comments on commit 7e9e874

Please sign in to comment.