Skip to content

Commit 949a8a8

Browse files
authored
chore: sort storage keys and test files in blockchaintest output (#3186)
* chore: sort storage keys and test files in blockchaintest output * sort storage keys and print all slots in blockchaintest output * sort storage keys and print all slots in blockchaintest output
1 parent 2b3a3aa commit 949a8a8

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

bins/revme/src/cmd/blockchaintest.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,11 @@ fn print_error_with_state(
607607
);
608608
if !storage.is_empty() {
609609
eprintln!(" Storage ({} slots):", storage.len());
610-
for (key, value) in storage.iter().take(5) {
610+
let mut sorted_storage: Vec<_> = storage.iter().collect();
611+
sorted_storage.sort_by_key(|(key, _)| *key);
612+
for (key, value) in sorted_storage.iter() {
611613
eprintln!(" {key:?} => {value:?}");
612614
}
613-
if storage.len() > 5 {
614-
eprintln!(" ... and {} more slots", storage.len() - 5);
615-
}
616615
}
617616
}
618617

@@ -632,12 +631,11 @@ fn print_error_with_state(
632631
);
633632
if !storage.is_empty() {
634633
eprintln!(" Storage ({} slots):", storage.len());
635-
for (key, value) in storage.iter().take(5) {
634+
let mut sorted_storage: Vec<_> = storage.iter().collect();
635+
sorted_storage.sort_by_key(|(key, _)| *key);
636+
for (key, value) in sorted_storage.iter() {
636637
eprintln!(" {key:?} => {value:?}");
637638
}
638-
if storage.len() > 5 {
639-
eprintln!(" ... and {} more slots", storage.len() - 5);
640-
}
641639
}
642640
}
643641

@@ -653,12 +651,9 @@ fn print_error_with_state(
653651
}
654652
if !account.storage.is_empty() {
655653
eprintln!(" Storage ({} slots):", account.storage.len());
656-
for (key, value) in account.storage.iter().take(5) {
654+
for (key, value) in account.storage.iter() {
657655
eprintln!(" {key:?} => {value:?}");
658656
}
659-
if account.storage.len() > 5 {
660-
eprintln!(" ... and {} more slots", account.storage.len() - 5);
661-
}
662657
}
663658
}
664659
}

0 commit comments

Comments
 (0)