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

feat(ipc): enable anvil ipc tests #6570

Merged
merged 1 commit into from
Dec 11, 2023
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
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
Loading