-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make rom trace generation based on ordered keys * Improver verify_all script --------- Co-authored-by: zkronos73 <[email protected]>
- Loading branch information
Showing
3 changed files
with
74 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,87 @@ | ||
#!/bin/bash -x | ||
#!/bin/bash | ||
|
||
echo "Verify all ELF files found in a directory" | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <dirname>" | ||
# Check that at least one argument has been passed | ||
if [ "$#" -lt 1 ]; then | ||
echo "Usage: $0 <dirname> [-l/--list -b/--begin <first_file> -e/--end <last_file>]" | ||
exit 1 | ||
fi | ||
|
||
# Get the first argument as the directory path | ||
if [[ "$1" != "" ]]; then | ||
DIR="$1" | ||
else | ||
DIR=. | ||
fi | ||
|
||
shift | ||
echo "Verifying ELF files found in directory ${DIR}" | ||
|
||
ELF_FILES=`find $DIR -name my.elf` | ||
# Parse optional arguments | ||
LIST=0 | ||
BEGIN=0 | ||
END=0 | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
-l|--list) LIST=1 ;; | ||
-b|--begin) BEGIN=$2; shift; ;; | ||
-e|--end) END=$2; shift; ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
ELF_FILES=`find $DIR -type f -name my.elf |sort` | ||
|
||
# List files with their corresponding index | ||
COUNTER=0 | ||
for ELF_FILE in $ELF_FILES | ||
do | ||
COUNTER=$((COUNTER+1)) | ||
echo "File ${COUNTER}: ${ELF_FILE}" | ||
done | ||
|
||
# Log begin and end options, if provided | ||
if [ $BEGIN -ne 0 ]; then | ||
echo "Beginning at file ${BEGIN}"; | ||
fi | ||
if [ $END -ne 0 ]; then | ||
echo "Beginning at file ${END}"; | ||
fi | ||
|
||
# If just listing, exit | ||
if [ $LIST -eq 1 ]; then | ||
echo "Exiting after listing files"; | ||
exit 0; | ||
fi | ||
|
||
# Record the number of files | ||
MAX_COUNTER=${COUNTER} | ||
|
||
# Create and empty input file | ||
INPUT_FILE="/tmp/empty_input.bin" | ||
touch $INPUT_FILE | ||
|
||
# For all files | ||
COUNTER=0 | ||
|
||
for ELF_FILE in $ELF_FILES | ||
do | ||
# Increase file counter | ||
COUNTER=$((COUNTER+1)) | ||
|
||
# Skip files lower than BEGIN | ||
if [ $BEGIN -ne 0 ] && [ $COUNTER -lt $BEGIN ]; then | ||
continue; | ||
fi | ||
|
||
# Skip files higher than END | ||
if [ $END -ne 0 ] && [ $COUNTER -gt $END ]; then | ||
continue; | ||
fi | ||
|
||
# Varify the contraints for this file | ||
echo "" | ||
echo "Verifying file ${COUNTER}: ${ELF_FILE}" | ||
echo "Verifying file ${COUNTER} of ${MAX_COUNTER}: ${ELF_FILE}" | ||
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom $ELF_FILE -i $INPUT_FILE --proving-key ../zisk/build/provingKey) | ||
COUNTER=$((COUNTER+1)) | ||
done | ||
|