From 0ba2b3edf4dfe6b9240e987a23517ad063d9d828 Mon Sep 17 00:00:00 2001 From: pefontana Date: Mon, 21 Oct 2024 13:49:08 -0300 Subject: [PATCH 1/5] Update block count scripts --- scripts/cmp_state_dumps.sh | 14 ++++++++++---- scripts/delta_state_dumps.sh | 12 +++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/cmp_state_dumps.sh b/scripts/cmp_state_dumps.sh index 5874e7f..32c6cdd 100755 --- a/scripts/cmp_state_dumps.sh +++ b/scripts/cmp_state_dumps.sh @@ -3,12 +3,18 @@ matching=0 diffing=0 -for vm_dump in state_dumps/vm/*/*.json; do - [ -f "$vm_dump" ] || continue +for native_dump in state_dumps/native/*/*.json; do + [ -f "$native_dump" ] || continue - native_dump="${vm_dump//vm/native}" + vm_dump="${native_dump//native/vm}" - base=$(basename "$native_dump") + # Check if the corresponding vm_dump file exists, if not, skip + if [ ! -f "$vm_dump" ]; then + echo "Skipping: $vm_dump (file not found)" + continue + fi + + base=$(basename "$vm_dump") if ! cmp -s \ <(sed '/"reverted": /d' "$native_dump") \ diff --git a/scripts/delta_state_dumps.sh b/scripts/delta_state_dumps.sh index 922bcd5..f04f062 100755 --- a/scripts/delta_state_dumps.sh +++ b/scripts/delta_state_dumps.sh @@ -11,7 +11,7 @@ function prompt_continue { done } -for block in state_dumps/vm/*/; do +for block in state_dumps/native/*/; do [ -d "$block" ] || continue block_name=$(basename "$block") @@ -20,8 +20,14 @@ for block in state_dumps/vm/*/; do # 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" + vm_tx="state_dumps/vm/$block_name/$tx_name" + + # Check if the corresponding vm_tx file exists, if not, skip + if [ ! -f "$vm_tx" ]; then + echo "Skipping: $vm_tx (file not found)" + continue + fi if cmp -s \ <(sed '/"reverted": /d' "$native_tx") \ @@ -33,7 +39,7 @@ for block in state_dumps/vm/*/; do echo "Tx ${tx_name//.*/}" prompt_continue && { - delta "$native_tx" "$vm_tx" --side-by-side --paging always --wrap-max-lines unlimited + delta "$native_tx" "$vm_tx" --side-by-side --paging always --wrap-max-lines unlimited } done done From 93f4f13685692cc351ba4ab93939543bf8553342 Mon Sep 17 00:00:00 2001 From: pefontana Date: Mon, 21 Oct 2024 13:53:35 -0300 Subject: [PATCH 2/5] Restore Cargo files --- Cargo.lock | 6 +++--- Cargo.toml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10dd3aa..5cb3033 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,7 +476,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=c501d392f60bdcf18f02608ec8b50e5bf501e2d0#c501d392f60bdcf18f02608ec8b50e5bf501e2d0" +source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" dependencies = [ "anyhow", "ark-ec", @@ -3037,7 +3037,7 @@ dependencies = [ [[package]] name = "papyrus_config" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=c501d392f60bdcf18f02608ec8b50e5bf501e2d0#c501d392f60bdcf18f02608ec8b50e5bf501e2d0" +source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" dependencies = [ "clap", "itertools 0.10.5", @@ -4431,7 +4431,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.0.0" -source = "git+https://github.com/lambdaclass/sequencer?rev=c501d392f60bdcf18f02608ec8b50e5bf501e2d0#c501d392f60bdcf18f02608ec8b50e5bf501e2d0" +source = "git+https://github.com/lambdaclass/sequencer?branch=native2.8.x#1eaaa4b9902cd9f4a867b111ca87c3a3bfce5d29" dependencies = [ "bitvec", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index 8e16469..2e19221 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,9 @@ resolver = "2" [workspace.dependencies] thiserror = "1.0.32" starknet-types-core = "0.1.6" -starknet_api = { git = "https://github.com/lambdaclass/sequencer", rev = "c501d392f60bdcf18f02608ec8b50e5bf501e2d0"} -blockifier = { git = "https://github.com/lambdaclass/sequencer", rev = "c501d392f60bdcf18f02608ec8b50e5bf501e2d0"} -cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "82c25b377f50904e1253b614c8719388277530e6" } +starknet_api = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.8.x"} +blockifier = { git = "https://github.com/lambdaclass/sequencer", branch = "native2.8.x"} +cairo-native = { git = "https://github.com/lambdaclass/cairo_native" } tracing = "0.1" serde_json = "1.0.116" serde_with = "3.9.0" From d04dce4e1947cc0ff4fedabd1d1e9575b0b614c5 Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 23 Oct 2024 12:47:54 -0300 Subject: [PATCH 3/5] Update cmp_state_dumps with skips counter --- scripts/cmp_state_dumps.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/cmp_state_dumps.sh b/scripts/cmp_state_dumps.sh index 32c6cdd..7a03816 100755 --- a/scripts/cmp_state_dumps.sh +++ b/scripts/cmp_state_dumps.sh @@ -2,15 +2,18 @@ matching=0 diffing=0 +skipping=0 -for native_dump in state_dumps/native/*/*.json; do - [ -f "$native_dump" ] || continue +# Iterate over state_dumps/vm dumps +for vm_dump in state_dumps/vm/*/*.json; do + [ -f "$vm_dump" ] || continue - vm_dump="${native_dump//native/vm}" + native_dump="${vm_dump//vm/native}" - # Check if the corresponding vm_dump file exists, if not, skip - if [ ! -f "$vm_dump" ]; then - echo "Skipping: $vm_dump (file not found)" + # Check if the corresponding native_dump file exists, if not, skip + if [ ! -f "$native_dump" ]; then + echo "Skipping: $native_dump (file not found)" + skipping=$((skipping+1)) continue fi @@ -32,3 +35,4 @@ echo echo "Finished comparison" echo "- Matching: $matching" echo "- Diffing: $diffing" +echo "- Skipping: $skipping" From b6eea2828bde64e76670e3c7ac7bc9aea4db5859 Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 23 Oct 2024 14:56:44 -0300 Subject: [PATCH 4/5] Add doc --- scripts/cmp_state_dumps.sh | 7 +++++++ scripts/delta_state_dumps.sh | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/cmp_state_dumps.sh b/scripts/cmp_state_dumps.sh index 7a03816..5ed8384 100755 --- a/scripts/cmp_state_dumps.sh +++ b/scripts/cmp_state_dumps.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +# Compares state dump files between two directories: 'state_dumps/vm' and 'state_dumps/native'. +# It iterates over all JSON files in the 'state_dumps/vm' directory and checks if the corresponding +# file exists in 'state_dumps/native'. +# If the corresponding file does not exist, it skips the comparison and counts the skipped files. +# For existing pairs, it compares the contents, ignoring the lines containing the "reverted" field, because of error message diference in Native and VM. +# It counts and displays the number of matching, differing, and skipped state dumps. + matching=0 diffing=0 skipping=0 diff --git a/scripts/delta_state_dumps.sh b/scripts/delta_state_dumps.sh index f04f062..60090ed 100755 --- a/scripts/delta_state_dumps.sh +++ b/scripts/delta_state_dumps.sh @@ -11,7 +11,7 @@ function prompt_continue { done } -for block in state_dumps/native/*/; do +for block in state_dumps/vm/*/; do [ -d "$block" ] || continue block_name=$(basename "$block") @@ -23,9 +23,9 @@ for block in state_dumps/native/*/; do native_tx="state_dumps/native/$block_name/$tx_name" vm_tx="state_dumps/vm/$block_name/$tx_name" - # Check if the corresponding vm_tx file exists, if not, skip - if [ ! -f "$vm_tx" ]; then - echo "Skipping: $vm_tx (file not found)" + # Check if the corresponding native_tx file exists, if not, skip + if [ ! -f "$native_tx" ]; then + echo "Skipping: $native_tx (file not found)" continue fi From 3e2af4d8da7f3546a86dec207f987d50f658fb77 Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 23 Oct 2024 15:03:15 -0300 Subject: [PATCH 5/5] Rename skipped -> missing --- scripts/cmp_state_dumps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/cmp_state_dumps.sh b/scripts/cmp_state_dumps.sh index 5ed8384..7042d20 100755 --- a/scripts/cmp_state_dumps.sh +++ b/scripts/cmp_state_dumps.sh @@ -3,13 +3,13 @@ # Compares state dump files between two directories: 'state_dumps/vm' and 'state_dumps/native'. # It iterates over all JSON files in the 'state_dumps/vm' directory and checks if the corresponding # file exists in 'state_dumps/native'. -# If the corresponding file does not exist, it skips the comparison and counts the skipped files. +# If the corresponding file does not exist, it skips the comparison and counts the missing files. # For existing pairs, it compares the contents, ignoring the lines containing the "reverted" field, because of error message diference in Native and VM. -# It counts and displays the number of matching, differing, and skipped state dumps. +# It counts and displays the number of matching, differing, and missing state dumps. matching=0 diffing=0 -skipping=0 +missing=0 # Iterate over state_dumps/vm dumps for vm_dump in state_dumps/vm/*/*.json; do @@ -19,8 +19,8 @@ for vm_dump in state_dumps/vm/*/*.json; do # Check if the corresponding native_dump file exists, if not, skip if [ ! -f "$native_dump" ]; then - echo "Skipping: $native_dump (file not found)" - skipping=$((skipping+1)) + echo "Missing: $native_dump (file not found)" + missing=$((missing+1)) continue fi @@ -42,4 +42,4 @@ echo echo "Finished comparison" echo "- Matching: $matching" echo "- Diffing: $diffing" -echo "- Skipping: $skipping" +echo "- Missing: $missing"