Skip to content

Commit a8239c5

Browse files
authored
export updated information to proof_status folder (#44)
The goal here is to allow us sync up the proof information with minimal but sufficient information for quick investigation. The updated run-proof.sh will: 1. export the proof's related commits of `solana-token` and `mir-semantics` 2. export the proof's duration (maybe we should also export information like k version and machine info for reproducing the result.) 3. export the least proof structure for investigation: `kmir show --statistics --leaves`.
1 parent 67fed8e commit a8239c5

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

p-token/test-properties/run-proofs.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ fi
5252

5353
set -u
5454

55+
mkdir -p proof_status
56+
57+
REPO_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
58+
if git status --porcelain 1>/dev/null 2>&1 && [ -n "$(git status --porcelain 2>/dev/null)" ]; then
59+
REPO_COMMIT="${REPO_COMMIT}-dirty"
60+
fi
61+
62+
MIR_COMMIT=$(git -C mir-semantics rev-parse --short HEAD 2>/dev/null || echo "unknown")
63+
if git -C mir-semantics status --porcelain 1>/dev/null 2>&1 && \
64+
[ -n "$(git -C mir-semantics status --porcelain 2>/dev/null)" ]; then
65+
MIR_COMMIT="${MIR_COMMIT}-dirty"
66+
fi
67+
5568
if [ -z "${RELOAD_OPT}" ]; then
5669
MODE="Continuing"
5770
else
@@ -65,12 +78,50 @@ prefix=pinocchio_token_program::entrypoint::
6578
for name in $TESTS; do
6679
echo "============================== $name ============================"
6780
start=$prefix$name
81+
status_file=proof_status/${name}.txt
82+
start_time=$(date +%s)
83+
6884
timeout --preserve-status -v ${TIMEOUT} \
6985
uv --project mir-semantics/kmir run -- \
7086
kmir prove-rs --smir artefacts/p-token.smir.json \
7187
--proof-dir artefacts/proof --verbose --start-symbol $start ${RELOAD_OPT} ${PROVE_OPTS}
88+
prove_rc=$?
89+
90+
end_time=$(date +%s)
91+
duration=$((end_time - start_time))
92+
93+
previous_duration=0
94+
if [ -z "${RELOAD_OPT}" ] && [ -f "${status_file}" ]; then
95+
previous_duration_line=$(grep -m1 '^total_duration_seconds:' "${status_file}" || true)
96+
if [ -z "${previous_duration_line}" ]; then
97+
previous_duration_line=$(grep -m1 '^duration_seconds:' "${status_file}" || true)
98+
fi
99+
if [ -n "${previous_duration_line}" ]; then
100+
previous_duration=$(echo "${previous_duration_line}" | awk -F': *' '{print $2}')
101+
fi
102+
if ! [[ "${previous_duration}" =~ ^[0-9]+$ ]]; then
103+
previous_duration=0
104+
fi
105+
fi
106+
107+
total_duration=$((previous_duration + duration))
108+
109+
{
110+
echo "name: ${name}"
111+
echo "timestamp: $(date -Is)"
112+
echo "duration_seconds: ${duration}"
113+
echo "total_duration_seconds: ${total_duration}"
114+
echo "prove_exit_code: ${prove_rc}"
115+
echo "repo_commit: ${REPO_COMMIT}"
116+
echo "mir_semantics_commit: ${MIR_COMMIT}"
117+
echo ""
118+
} > "${status_file}"
119+
72120
uv --project mir-semantics/kmir run -- \
73121
kmir show --proof-dir artefacts/proof p-token.smir.$start \
74122
--full-printer > artefacts/proof/${name}-full.txt
123+
uv --project mir-semantics/kmir run -- \
124+
kmir show --dir artefacts/proof p-token.smir.$start \
125+
--statistics --leaves >> "${status_file}"
75126
echo "==========================================================================="
76127
done

0 commit comments

Comments
 (0)