diff --git a/.github/workflows/pr_checking.yml b/.github/workflows/pr_checking.yml index 10ca3d9fe..adc6d81bc 100644 --- a/.github/workflows/pr_checking.yml +++ b/.github/workflows/pr_checking.yml @@ -58,4 +58,3 @@ jobs: run: gh pr close ${{ github.event.pull_request.number }} --comment "Spam detected" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 000000000..e7b826555 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,26 @@ +--- # Workflow to run shellckeck on all shell scripts + +name: Shellcheck +on: + pull_request: + paths: + - '**/*.sh' + - 'scripts/**' + workflow_dispatch: + branches: + - "**" + +jobs: + shellcheck_scripts: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - name: Install shellcheck + run: sudo apt-get install shellcheck=0.8.0-2 + + - name: Run shellcheck + run: | + cd scripts + shellcheck ./*.sh diff --git a/scripts/prove_stdio.sh b/scripts/prove_stdio.sh index c3c794086..b0d0788ca 100755 --- a/scripts/prove_stdio.sh +++ b/scripts/prove_stdio.sh @@ -95,15 +95,22 @@ fi # proof. This is useful for quickly testing decoding and all of the # other non-proving code. if [[ $TEST_ONLY == "test_only" ]]; then - cargo run --quiet --release --package zero --bin leader -- --test-only --runtime in-memory --load-strategy on-demand --block-batch-size $BLOCK_BATCH_SIZE --proof-output-dir $PROOF_OUTPUT_DIR stdio < $INPUT_FILE &> $TEST_OUT_PATH - if grep -q 'All proof witnesses have been generated successfully.' $TEST_OUT_PATH; then + cargo run --quiet --release --package zero --bin leader -- \ + --test-only \ + --runtime in-memory \ + --load-strategy on-demand \ + --block-batch-size "$BLOCK_BATCH_SIZE" \ + --proof-output-dir "$PROOF_OUTPUT_DIR" \ + stdio < "$INPUT_FILE" &> "$TEST_OUT_PATH" + + if grep -q 'All proof witnesses have been generated successfully.' "$TEST_OUT_PATH"; then echo -e "\n\nSuccess - Note this was just a test, not a proof" - rm $TEST_OUT_PATH + rm "$TEST_OUT_PATH" exit else # Some error occurred, display the logs and exit. - cat $OUT_LOG_PATH - echo "Failed to create proof witnesses. See $OUT_LOG_PATH for more details." + cat "$TEST_OUT_PATH" + echo "Failed to create proof witnesses. See $TEST_OUT_PATH for more details." exit 1 fi fi @@ -112,45 +119,43 @@ cargo build --release --jobs "$num_procs" start_time=$(date +%s%N) -"${REPO_ROOT}/target/release/leader" --runtime in-memory --load-strategy on-demand -n 1 --block-batch-size $BLOCK_BATCH_SIZE \ - --proof-output-dir $PROOF_OUTPUT_DIR stdio < $INPUT_FILE &> $OUTPUT_LOG +"${REPO_ROOT}/target/release/leader" --runtime in-memory \ + --load-strategy on-demand -n 1 \ + --block-batch-size "$BLOCK_BATCH_SIZE" \ + --proof-output-dir "$PROOF_OUTPUT_DIR" stdio < "$INPUT_FILE" &> "$OUTPUT_LOG" end_time=$(date +%s%N) -cat $OUTPUT_LOG | grep "Successfully wrote to disk proof file " | awk '{print $NF}' | tee $PROOFS_FILE_LIST +grep "Successfully wrote to disk proof file " "$OUTPUT_LOG" | awk '{print $NF}' | tee "$PROOFS_FILE_LIST" if [ ! -s "$PROOFS_FILE_LIST" ]; then # Some error occurred, display the logs and exit. - cat $OUTPUT_LOG + cat "$OUTPUT_LOG" echo "Proof list not generated, some error happened. For more details check the log file $OUTPUT_LOG" exit 1 fi -cat $PROOFS_FILE_LIST | while read proof_file; +while read -r proof_file; do echo "Verifying proof file $proof_file" - verify_file=$PROOF_OUTPUT_DIR/verify_$(basename $proof_file).out - "${REPO_ROOT}/target/release/verifier" -f $proof_file | tee $verify_file - if grep -q 'All proofs verified successfully!' $verify_file; then + verify_file=$PROOF_OUTPUT_DIR/verify_$(basename "$proof_file").out + "${REPO_ROOT}/target/release/verifier" -f "$proof_file" | tee "$verify_file" + if grep -q 'All proofs verified successfully!' "$verify_file"; then echo "Proof verification for file $proof_file successful"; - rm $verify_file # we keep the generated proof for potential reuse + rm "$verify_file" # we keep the generated proof for potential reuse else # Some error occurred with verification, display the logs and exit. - cat $verify_file + cat "$verify_file" echo "There was an issue with proof verification. See $verify_file for more details."; exit 1 fi -done +done < "$PROOFS_FILE_LIST" duration_ns=$((end_time - start_time)) duration_sec=$(echo "$duration_ns / 1000000000" | bc -l) echo "Success!" -echo "Proving duration:" $duration_sec " seconds" +echo "Proving duration: $duration_sec seconds" echo "Note, this duration is inclusive of circuit handling and overall process initialization"; # Clean up in case of success -rm $OUTPUT_LOG - - - - +rm "$OUTPUT_LOG"