Skip to content

Commit

Permalink
test(anvil): use retryprovider (#4605)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Mar 19, 2023
1 parent 3df81f1 commit 394f217
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions anvil/tests/it/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use ethers::{
U256,
},
};
use foundry_common::get_http_provider;
use foundry_config::Config;
use foundry_utils::{rpc, rpc::next_http_rpc_endpoint};
use futures::StreamExt;
Expand Down Expand Up @@ -588,14 +589,11 @@ async fn test_reset_fork_on_new_blocks() {
let anvil_provider = handle.http_provider();

let endpoint = next_http_rpc_endpoint();
let provider =
Arc::new(Provider::try_from(&endpoint).unwrap().interval(Duration::from_secs(2)));
let provider = Arc::new(get_http_provider(&endpoint).interval(Duration::from_secs(2)));

let current_block = anvil_provider.get_block_number().await.unwrap();

handle.task_manager().spawn_reset_on_new_polled_blocks(provider, api);

let provider = Provider::try_from(endpoint).unwrap();
handle.task_manager().spawn_reset_on_new_polled_blocks(provider.clone(), api);

let mut stream = provider.watch_blocks().await.unwrap();
// the http watcher may fetch multiple blocks at once, so we set a timeout here to offset edge
Expand Down

0 comments on commit 394f217

Please sign in to comment.