From 89aeb19e4310dd8db554f3bab6b3371858c287d6 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:50:56 -0700 Subject: [PATCH 1/2] Update trace.rs --- crates/rpc/rpc-testing-util/tests/it/trace.rs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-testing-util/tests/it/trace.rs b/crates/rpc/rpc-testing-util/tests/it/trace.rs index 0e3d6559fd65..3adc245fd410 100644 --- a/crates/rpc/rpc-testing-util/tests/it/trace.rs +++ b/crates/rpc/rpc-testing-util/tests/it/trace.rs @@ -1,7 +1,8 @@ +use futures::StreamExt; use jsonrpsee::http_client::HttpClientBuilder; use reth_rpc_api_testing_util::{trace::TraceApiExt, utils::parse_env_url}; -use std::time::Instant; - +use reth_rpc_types::trace::parity::TraceType; +use std::{collections::HashSet, time::Instant}; /// This is intended to be run locally against a running node. /// /// This is a noop of env var `RETH_RPC_TEST_NODE_URL` is not set. @@ -21,3 +22,28 @@ async fn trace_many_blocks() { } println!("Traced all blocks in {:?}", now.elapsed()); } + +/// Tests the replaying of transactions on a local Ethereum node. + +#[tokio::test(flavor = "multi_thread")] +async fn replay_transactions_() { + let url = parse_env_url("RETH_RPC_TEST_NODE_URL"); + if url.is_err() { + return + } + let client = HttpClientBuilder::default().build(url.unwrap()).unwrap(); + + let tx_hashes = vec![ + "0x4e08fe36db723a338e852f89f613e606b0c9a17e649b18b01251f86236a2cef3".parse().unwrap(), + "0xea2817f1aeeb587b82f4ab87a6dbd3560fc35ed28de1be280cb40b2a24ab48bb".parse().unwrap(), + ]; + + let trace_types = HashSet::from([TraceType::StateDiff, TraceType::VmTrace]); + + let mut stream = client.replay_transactions(tx_hashes, trace_types); + let now = Instant::now(); + while let Some(replay_txs) = stream.next().await { + println!("Transaction: {:?}", replay_txs); + println!("Replayed transactions in {:?}", now.elapsed()); + } +} From 0e77e6c5d9f67920878b69fedaab0d73882bf26f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 4 Nov 2023 08:33:08 +0100 Subject: [PATCH 2/2] chore: add ignore --- crates/rpc/rpc-testing-util/tests/it/trace.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/rpc/rpc-testing-util/tests/it/trace.rs b/crates/rpc/rpc-testing-util/tests/it/trace.rs index 3adc245fd410..eb83913f088b 100644 --- a/crates/rpc/rpc-testing-util/tests/it/trace.rs +++ b/crates/rpc/rpc-testing-util/tests/it/trace.rs @@ -26,12 +26,10 @@ async fn trace_many_blocks() { /// Tests the replaying of transactions on a local Ethereum node. #[tokio::test(flavor = "multi_thread")] -async fn replay_transactions_() { - let url = parse_env_url("RETH_RPC_TEST_NODE_URL"); - if url.is_err() { - return - } - let client = HttpClientBuilder::default().build(url.unwrap()).unwrap(); +#[ignore] +async fn replay_transactions() { + let url = parse_env_url("RETH_RPC_TEST_NODE_URL").unwrap(); + let client = HttpClientBuilder::default().build(url).unwrap(); let tx_hashes = vec![ "0x4e08fe36db723a338e852f89f613e606b0c9a17e649b18b01251f86236a2cef3".parse().unwrap(),