Skip to content

Commit

Permalink
fix pruner tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Sep 25, 2023
1 parent 995e9a6 commit 8b2ff4f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/prune/src/pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1506,15 +1506,19 @@ mod tests {
let tx = TestTransaction::default();
let mut rng = generators::rng();

let tip = 300;
let blocks = random_block_range(&mut rng, 0..=tip, H256::zero(), 1..5);
let tip = 20000;
let blocks = [
random_block_range(&mut rng, 0..=100, H256::zero(), 1..5),
random_block_range(&mut rng, (100 + 1)..=(tip - 100), H256::zero(), 0..1),
random_block_range(&mut rng, (tip - 100 + 1)..=tip, H256::zero(), 1..5),
]
.concat();
tx.insert_blocks(blocks.iter(), None).expect("insert blocks");

let mut receipts = Vec::new();

let (deposit_contract_addr, _) = random_eoa_account(&mut rng);
for block in &blocks {
assert!(!block.body.is_empty());
for (txi, transaction) in block.body.iter().enumerate() {
let mut receipt = random_receipt(&mut rng, transaction, Some(1));
receipt.logs.push(random_log(
Expand Down Expand Up @@ -1552,7 +1556,7 @@ mod tests {
..Default::default()
},
// Less than total amount of blocks to prune to test the batching logic
PruneBatchSizes::default().with_storage_history(10),
PruneBatchSizes::default().with_receipts(10),
);

let result = pruner.prune_receipts_by_logs(&provider, tip);
Expand Down

0 comments on commit 8b2ff4f

Please sign in to comment.