Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Options:
--num-blocks <NUM_BLOCKS> Number of blocks to test from the tip [default: 32]
--use-reth Whether to query reth namespace
--use-tracing Whether to query tracing methods
--use-all-txes Whether to query every transacion from a block or just the first
--use-all-txes Whether to query every transaction from a block or just the first
--rate-limit <RATE_LIMIT> Maximum requests per second (rate limit)
--timeout <TIMEOUT> Maximum time to wait for syncing in seconds [default: 300]
-h, --help Print help
Expand Down
11 changes: 6 additions & 5 deletions crates/rpc-tester-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CliArgs {
#[arg(long, value_name = "TRACING", default_value = "false")]
pub use_tracing: bool,

/// Whether to query every transacion from a block or just the first.
/// Whether to query every transaction from a block or just the first.
#[arg(long, value_name = "ALL_TXES", default_value = "false")]
pub use_all_txes: bool,

Expand Down Expand Up @@ -69,7 +69,9 @@ async fn main() -> eyre::Result<()> {
.network::<AnyNetwork>()
.on_http(args.rpc2);

let block_range = wait_for_readiness(&rpc1, &rpc2, args.num_blocks).await?;
let timeout = Duration::from_secs(args.timeout);

let block_range = wait_for_readiness(&rpc1, &rpc2, args.num_blocks, timeout).await?;

RpcTester::builder(rpc1, rpc2)
.with_tracing(args.use_tracing)
Expand All @@ -87,17 +89,16 @@ pub async fn wait_for_readiness<P: Provider<AnyNetwork>>(
rpc1: &P,
rpc2: &P,
block_size_range: u64,
timeout: Duration,
) -> eyre::Result<RangeInclusive<u64>> {
let args = CliArgs::parse();
let start_time = Instant::now();
let timeout = Duration::from_secs(args.timeout);

// Waits until it's done syncing
while let SyncStatus::Info(sync_info) = rpc1.syncing().await? {
if start_time.elapsed() > timeout {
return Err(eyre::eyre!(
"Timeout waiting for rpc1 to sync after {} seconds",
args.timeout
timeout.as_secs()
));
}
info!(?sync_info, "rpc1 still syncing");
Expand Down