-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement CairoPieMetadata validity checks * Save progres * Progress * Progress * Clippy * Impl generic serialization for suffixed ver * Implement custom generic deserialization * Rename module * Complete API * Add docs & examples * Fix docs * Remove reference from method * Add clippy allow * Add changelog entry * Add no-std import * Fix * fmt * Use a wrapper for CairoPie additional data * Update changelog * Fix tests + fmt * Add test for validity checks * Start implementing cairo_run_pie * Implement extend_additional_data for hash * Handle check * Simplify * Simplify * Implement extend_additional_data for ecdsa * Add test * Implement extend_additional_data for output * Implement extend_additional_data for enum * Add changelog entry * Add doc comments to get_additional_data & extend_additional_data * Check n_steps * Fail if proof mode * wip * Finalize segments by cairo pie * Add integration test for fibonacci * Impl check_pie_compatibility * Simplify code * Generalize test * Extend additional data * Improve test * Fix bug + add more test cases * Add more test cases * Add doc * Add test * Add docs * Add changelog entry * clippy * changelog * fmt * First steps * Deserialize prime * Impl CairoPieMemory::from_bytes * Finish read_zip_file * Fix endianness * Impl deserialize for hash additional data * Impl custom deser for signature additional data * Deserialize hash additional data as a sequence * Add more test cases * Clippy * Remove todo from pre-existing code * Use a constant for prime * Fix imports * Remove files generated by test * Add changelog entry * Fix imports * Fix imports * Add run_from_cairo_pie flag * Add doc * Fmt + cleanup + Silence pie comparator when successful * Add script * Add Makefile target * Push workflow * Update gitignore * Add changelog entry * Fix workflow * fetch pies * fetch pies * Fix workflow * Fix workflow * Fix workflow * Fix workflow * Fix workflow * Fix workflow * Fix workflow * Update script file permissions * Fix workflow * Revert "Fix workflow" This reverts commit 9944a1d. * Break the silence * Remove duplicate entries * Fix * Update README.md * Update README.md
- Loading branch information
Showing
9 changed files
with
148 additions
and
15 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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env sh | ||
|
||
# move to the directory where the script is located | ||
cd $(dirname "$0") | ||
|
||
tests_path="../../../cairo_programs/" | ||
exit_code=0 | ||
passed_tests=0 | ||
failed_tests=0 | ||
|
||
files=$(ls $tests_path) | ||
EXIT_CODE=$? | ||
if [ ${EXIT_CODE} != 0 ]; then | ||
exit ${EXIT_CODE} | ||
fi | ||
|
||
for file in $(ls $tests_path | grep .rs.pie.zip$ | sed -E 's/\.rs.pie.zip$//'); do | ||
path_file="$tests_path/$file" | ||
|
||
# Run Cairo PIE using cairo_lang | ||
echo "Running $file PIE with cairo_lang" | ||
if ! cairo-run --run_from_cairo_pie $path_file.rs.pie.zip --trace_file $path_file.trace.pie --memory_file $path_file.memory.pie --cairo_pie_output $path_file.pie.zip.pie --layout starknet_with_keccak 2> /dev/null; then | ||
echo "Skipping $file.pie as it fails validations in cairo_lang" | ||
break | ||
fi | ||
echo "Running $file PIE with cairo-vm" | ||
cargo run -p cairo-vm-cli --release $path_file.rs.pie.zip --run_from_cairo_pie --trace_file $path_file.rs.trace.pie --memory_file $path_file.rs.memory.pie --cairo_pie_output $path_file.rs.pie.zip.pie --layout starknet_with_keccak | ||
# Compare PIE outputs | ||
echo "Comparing $file.pie outputs" | ||
|
||
# Compare trace | ||
if ! diff -q $path_file.trace.pie $path_file.rs.trace.pie; then | ||
echo "Traces for $file differ" | ||
exit_code=1 | ||
failed_tests=$((failed_tests + 1)) | ||
else | ||
passed_tests=$((passed_tests + 1)) | ||
fi | ||
|
||
# Compare Memory | ||
if ! ./memory_comparator.py $path_file.memory.pie $path_file.rs.memory.pie; then | ||
echo "Memory differs for $file" | ||
exit_code=1 | ||
failed_tests=$((failed_tests + 1)) | ||
else | ||
passed_tests=$((passed_tests + 1)) | ||
fi | ||
|
||
# Compare PIE | ||
if ! ./cairo_pie_comparator.py $path_file.pie.zip.pie $path_file.rs.pie.zip.pie; then | ||
echo "Cairo PIE differs for $file" | ||
exit_code=1 | ||
failed_tests=$((failed_tests + 1)) | ||
else | ||
passed_tests=$((passed_tests + 1)) | ||
fi | ||
done | ||
|
||
if test $failed_tests != 0; then | ||
echo "Comparisons: $failed_tests failed, $passed_tests passed, $((failed_tests + passed_tests)) total" | ||
elif test $passed_tests = 0; then | ||
echo "No tests ran!" | ||
exit_code=2 | ||
else | ||
echo "All $passed_tests tests passed; no discrepancies found" | ||
fi | ||
|
||
exit "${exit_code}" |
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