From e79199a3be4d152899e12f77e71fc3b585543a4f Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Tue, 31 Dec 2024 00:24:23 +0700 Subject: [PATCH] feat(tx-pool): make benchmark inputs deterministic (#13570) --- crates/transaction-pool/benches/priority.rs | 6 ++---- crates/transaction-pool/benches/reorder.rs | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/transaction-pool/benches/priority.rs b/crates/transaction-pool/benches/priority.rs index 196e76ed0..ac1755e81 100644 --- a/crates/transaction-pool/benches/priority.rs +++ b/crates/transaction-pool/benches/priority.rs @@ -7,14 +7,12 @@ use reth_transaction_pool::{blob_tx_priority, fee_delta}; use std::hint::black_box; fn generate_test_data_fee_delta() -> (u128, u128) { - let config = ProptestConfig::default(); - let mut runner = TestRunner::new(config); + let mut runner = TestRunner::deterministic(); prop::arbitrary::any::<(u128, u128)>().new_tree(&mut runner).unwrap().current() } fn generate_test_data_priority() -> (u128, u128, u128, u128) { - let config = ProptestConfig::default(); - let mut runner = TestRunner::new(config); + let mut runner = TestRunner::deterministic(); prop::arbitrary::any::<(u128, u128, u128, u128)>().new_tree(&mut runner).unwrap().current() } diff --git a/crates/transaction-pool/benches/reorder.rs b/crates/transaction-pool/benches/reorder.rs index e20a598d6..534f0e201 100644 --- a/crates/transaction-pool/benches/reorder.rs +++ b/crates/transaction-pool/benches/reorder.rs @@ -94,8 +94,7 @@ fn generate_test_data( seed_size: usize, input_size: usize, ) -> (Vec, Vec, u64) { - let config = ProptestConfig::default(); - let mut runner = TestRunner::new(config); + let mut runner = TestRunner::deterministic(); let txs = prop::collection::vec(any::(), seed_size) .new_tree(&mut runner)