Skip to content

Commit

Permalink
feat: enable anvil ipc tests (#6570)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir authored Dec 11, 2023
1 parent 009c43b commit e8e926e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions crates/anvil/tests/it/ipc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! IPC tests

use alloy_providers::provider::TempProvider;
use anvil::{spawn, NodeConfig};
use ethers::{core::rand, prelude::Middleware, types::U256};
use alloy_primitives::U256;
use ethers::{core::rand, prelude::Middleware};
use futures::StreamExt;

pub fn rand_ipc_endpoint() -> String {
Expand All @@ -22,19 +24,19 @@ async fn can_get_block_number_ipc() {
let (api, handle) = spawn(ipc_config()).await;

let block_num = api.block_number().unwrap();
assert_eq!(block_num, U256::zero());
assert_eq!(block_num, U256::ZERO);

let provider = handle.ipc_provider().unwrap();

let num = provider.get_block_number().await.unwrap();
assert_eq!(num, block_num.as_u64().into());
assert_eq!(num, block_num.to::<u64>());
}

#[tokio::test(flavor = "multi_thread")]
async fn test_sub_new_heads_ipc() {
let (api, handle) = spawn(ipc_config()).await;

let provider = handle.ipc_provider().unwrap();
let provider = handle.ethers_ipc_provider().unwrap();

let blocks = provider.subscribe_blocks().await.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod ganache;
mod gas;
mod genesis;
mod geth;
// mod ipc;
mod ipc;
mod logs;
mod optimism;
mod proof;
Expand Down

0 comments on commit e8e926e

Please sign in to comment.