-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d5cfd1
commit f7666f8
Showing
1 changed file
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
# If there are a lot of transactions, it can be difficult to quit the script. This prompts if the user wants to continue after each diff. | ||
# If there are a lot of transactions, it can be difficult to quit the script. This prompts if the user wants to diff the tx, allowing Ctrl+C. | ||
function prompt_continue { | ||
while true; do | ||
read -rp "Continue [Y/n]? " yn | ||
read -rp "Diff [Y/n]? " yn | ||
case $yn in | ||
[Yy]* ) break;; | ||
[Nn]* ) exit;; | ||
* ) break;; | ||
[Nn]* ) return 1;; | ||
* ) return 0;; | ||
esac | ||
done | ||
} | ||
|
||
for block_dir in state_dumps/vm/*/; do | ||
[ -d "$block_dir" ] || continue | ||
block_base=$(basename "$block_dir") | ||
for block in state_dumps/vm/*/; do | ||
[ -d "$block" ] || continue | ||
block_name=$(basename "$block") | ||
|
||
echo "Block ${block_base//block/}" | ||
echo "Block ${block_name//block/}" | ||
|
||
for vm_dump in "$block_dir"/*.json; do | ||
[ -f "$vm_dump" ] || continue | ||
native_dump="${vm_dump//vm/native}" | ||
# Compares the files in ascending order, by creation date | ||
IFS=$'\n' | ||
for tx_name in $(ls -trU1 $block); do | ||
vm_tx="state_dumps/vm/$block_name/$tx_name" | ||
native_tx="state_dumps/native/$block_name/$tx_name" | ||
|
||
if cmp -s \ | ||
<(sed '/"reverted": /d' "$native_dump") \ | ||
<(sed '/"reverted": /d' "$vm_dump") | ||
<(sed '/"reverted": /d' "$native_tx") \ | ||
<(sed '/"reverted": /d' "$vm_tx") | ||
then | ||
continue | ||
fi | ||
|
||
base=$(basename "$vm_dump") | ||
echo "Tx ${base//.json/}" | ||
echo "Tx ${tx_name//.*/}" | ||
|
||
prompt_continue | ||
|
||
delta "$native_dump" "$vm_dump" --side-by-side --paging always --wrap-max-lines unlimited | ||
prompt_continue && { | ||
delta "$native_tx" "$vm_tx" --side-by-side --paging always --wrap-max-lines unlimited | ||
} | ||
done | ||
done |