Skip to content

Commit

Permalink
feat (rpc-testing-utils) : enhenced trace filter streaming for local …
Browse files Browse the repository at this point in the history
…node (#5295)
  • Loading branch information
DoTheBestToGetTheBest authored Nov 6, 2023
1 parent 29a8489 commit 2846609
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion crates/rpc/rpc-testing-util/tests/it/trace.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use futures::StreamExt;
use jsonrpsee::http_client::HttpClientBuilder;
use reth_rpc_api_testing_util::{trace::TraceApiExt, utils::parse_env_url};
use reth_rpc_types::trace::parity::TraceType;
use reth_rpc_types::trace::{filter::TraceFilter, parity::TraceType};
use std::{collections::HashSet, time::Instant};
/// This is intended to be run locally against a running node.
///
Expand Down Expand Up @@ -45,3 +45,25 @@ async fn replay_transactions() {
println!("Replayed transactions in {:?}", now.elapsed());
}
}

/// Tests the tracers filters on a local Ethereum node

#[tokio::test(flavor = "multi_thread")]
#[ignore]
async fn trace_filters() {
// Parse the node URL from environment variable and create an HTTP client.
let url = parse_env_url("RETH_RPC_TEST_NODE_URL").unwrap();
let client = HttpClientBuilder::default().build(url).unwrap();

// Set up trace filters.
let filter = TraceFilter::default();
let filters = vec![filter];

// Initialize a stream for the trace filters.
let mut stream = client.trace_filter_stream(filters);
let start_time = Instant::now();
while let Some(trace) = stream.next().await {
println!("Transaction Trace: {:?}", trace);
println!("Duration since test start: {:?}", start_time.elapsed());
}
}

0 comments on commit 2846609

Please sign in to comment.