logos-blockchain-pocs/emmarin/cl/gen_risc0_images.sh

29 lines
961 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
# Order of these proofs is important, we sequence them topologically by composition order
proofs=$(cat <<EOF
2025-03-07 01:33:18 +04:00
risc0_proofs
bundle_risc0_proof
ledger_risc0_proof
EOF
)
for proof in $proofs; do
echo "Building $proof"
# Run the cargo risczero build command and process output line by line
cargo risczero build --manifest-path "$proof/Cargo.toml" | while read -r line; do
# Parse out the
2025-10-19 23:38:34 +04:00
if [[ $line =~ ImageID:\ ([0-9a-f]+)\ -\ (.+\.bin) ]]; then
image_id="${BASH_REMATCH[1]}"
image_elf="${BASH_REMATCH[2]}"
2025-10-19 23:38:34 +04:00
image_name=$(basename $image_elf .bin | tr '[:lower:]' '[:upper:]')
2025-03-06 01:14:40 +04:00
echo "${image_name}_ID: $image_id"
echo "${image_name}_ELF: $(cat $image_elf | xxd -p | head -c 32)..."
2025-03-06 00:23:49 +04:00
echo $image_id | tr -d '\n' > "risc0_images/src/${image_name}_ID"
2025-03-06 01:14:40 +04:00
cp $image_elf "risc0_images/src/${image_name}_ELF"
fi
done
done