Skip to content

Commit

Permalink
Merge pull request #15 from 0xPolygonZero/script_checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Jan 22, 2024
2 parents 40cab23 + 03f1d80 commit 4e1d363
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions zero_bin/tools/prove_blocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# 1 --> Start block idx
# 2 --> End block index (inclusive)
# 3 --> Rpc endpoint:port (eg. http://35.246.1.96:8545)
# 4 --> Ignore previous proofs (boolean)

export RUST_BACKTRACE=1
export RUST_LOG=plonky2=trace,plonky2_evm=trace
Expand All @@ -20,6 +21,7 @@ PROOF_OUTPUT_DIR="proofs"
ALWAYS_WRITE_LOGS=0 # Change this to `1` if you always want logs to be written.

TOT_BLOCKS=$(($2-$1+1))
IGNORE_PREVIOUS_PROOFS=$4

echo "Proving blocks ${1}..=${2}... (Total: ${TOT_BLOCKS})"
mkdir -p proofs/
Expand All @@ -31,9 +33,15 @@ do
OUT_PROOF_PATH="${PROOF_OUTPUT_DIR}/b${i}.zkproof"
OUT_LOG_PATH="${PROOF_OUTPUT_DIR}/b${i}.log"

if [ $i -gt 1 ]; then
if [ $IGNORE_PREVIOUS_PROOFS ]; then
# Set checkpoint height to previous block number
prev_proof_num=$((i-1))
PREV_PROOF_EXTRA_ARG="-f ${PROOF_OUTPUT_DIR}/b${prev_proof_num}.zkproof"
PREV_PROOF_EXTRA_ARG="--checkpoint-block-number ${prev_proof_num}"
else
if [ $i -gt 1 ]; then
prev_proof_num=$((i-1))
PREV_PROOF_EXTRA_ARG="-f ${PROOF_OUTPUT_DIR}/b${prev_proof_num}.zkproof"
fi
fi

cargo r --release --bin leader -- --runtime in-memory jerigon --rpc-url "$3" --block-number $i --proof-output-path $OUT_PROOF_PATH $PREV_PROOF_EXTRA_ARG > $OUT_LOG_PATH 2>&1
Expand Down

0 comments on commit 4e1d363

Please sign in to comment.