Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clippy
Browse files Browse the repository at this point in the history
staffik committed Jan 14, 2025
1 parent 73c6ce4 commit 66befc4
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions chain/chain/src/tests/garbage_collection.rs
Original file line number Diff line number Diff line change
@@ -192,7 +192,7 @@ fn gc_fork_common(simple_chains: Vec<SimpleChain>, max_changes: usize) {
}

// GC execution
chain1.clear_data(&GCConfig { gc_blocks_limit: 1000, ..GCConfig::default() }).unwrap();
chain1.clear_data(&GCConfig { gc_blocks_limit: 1000, ..GCConfig::default() }, None).unwrap();

let tries2 = get_chain_with_num_shards(Clock::real(), num_shards).runtime_adapter.get_tries();

@@ -624,11 +624,14 @@ fn test_fork_far_away_from_epoch_end() {

// GC execution
chain
.clear_data(&GCConfig {
gc_blocks_limit: 100,
gc_fork_clean_step: fork_clean_step,
..GCConfig::default()
})
.clear_data(
&GCConfig {
gc_blocks_limit: 100,
gc_fork_clean_step: fork_clean_step,
..GCConfig::default()
},
None,
)
.expect("Clear data failed");

// The run above would clear just the first 5 blocks from the beginning, but shouldn't clear any forks
@@ -670,7 +673,7 @@ fn test_fork_far_away_from_epoch_end() {
);
}
chain
.clear_data(&GCConfig { gc_blocks_limit: 100, ..GCConfig::default() })
.clear_data(&GCConfig { gc_blocks_limit: 100, ..GCConfig::default() }, None)
.expect("Clear data failed");
// And now all these blocks should be safely removed.
for i in 6..50 {
@@ -707,7 +710,7 @@ fn test_clear_old_data() {
);
}

chain.clear_data(&GCConfig { gc_blocks_limit: 100, ..GCConfig::default() }).unwrap();
chain.clear_data(&GCConfig { gc_blocks_limit: 100, ..GCConfig::default() }, None).unwrap();

for i in 0..=max_height {
println!("height = {} hash = {}", i, blocks[i].hash());
@@ -885,7 +888,9 @@ fn test_clear_old_data_too_many_heights_common(gc_blocks_limit: NumBlocks) {

for iter in 0..10 {
println!("ITERATION #{:?}", iter);
assert!(chain.clear_data(&GCConfig { gc_blocks_limit, ..GCConfig::default() }).is_ok());
assert!(chain
.clear_data(&GCConfig { gc_blocks_limit, ..GCConfig::default() }, None)
.is_ok());

// epoch didn't change so no data is garbage collected.
for i in 0..1000 {

0 comments on commit 66befc4

Please sign in to comment.