Skip to content

Commit 7f2fedd

Browse files
Add the unverified proofs to the summary
1 parent f87071d commit 7f2fedd

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

alerts/generate_send_summary.sh

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt"
2424
batches=0
2525
submitted_total=0
2626
verified_total=0
27+
unverified_total=0
2728
eth_total="0"
2829
usd_total="0"
2930

@@ -62,17 +63,48 @@ if [[ -f "$LOG_FILE" ]]; then
6263
usd_total=$(echo "$usd_total + $usd_spent" | bc -l)
6364
fi
6465
;;
66+
*"FAILURE:"*)
67+
batches=$((batches + 1))
68+
69+
proofs_submitted=$(printf '%s\n' "$line" \
70+
| grep -oE '[0-9]+ proofs submitted' \
71+
| head -1 \
72+
| cut -d' ' -f1)
73+
if [[ -n "$proofs_submitted" ]]; then
74+
submitted_total=$((submitted_total + proofs_submitted))
75+
fi
76+
77+
proofs_unverified=$(printf '%s\n' "$line" \
78+
| grep -oE '\([0-9]+ sent\)' \
79+
| grep -oE '[0-9]+' \
80+
| head -1)
81+
if [[ -n "$proofs_verified" ]]; then
82+
unverified_total=$((verified_total + proofs_verified))
83+
fi
84+
85+
eth_spent=$(printf '%s\n' "$line" \
86+
| sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p')
87+
if [[ -n "$eth_spent" ]]; then
88+
eth_total=$(echo "$eth_total + $eth_spent" | bc -l)
89+
fi
90+
91+
usd_spent=$(printf '%s\n' "$line" \
92+
| sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p')
93+
if [[ -n "$usd_spent" ]]; then
94+
usd_total=$(echo "$usd_total + $usd_spent" | bc -l)
95+
fi
6596
esac
6697
done < "$LOG_FILE"
6798

6899
summary=$(
69100
printf "Proof Submission Summary - %s\n" "$(date +'%Y-%m-%d %H:%M:%S')"
70101
echo "----------------------------------------"
71-
printf "Processed batches : %d\n" "$batches"
72-
printf "Proofs submitted : %d\n" "$submitted_total"
73-
printf "Proofs verified : %d\n" "$verified_total"
74-
printf "Total spent (ETH) : %.12f ETH\n" "$eth_total"
75-
printf "Total spent (USD) : $ %.2f\n" "$usd_total"
102+
printf "Processed batches : %d\n" "$batches"
103+
printf "Proofs submitted : %d\n" "$submitted_total"
104+
printf "Proofs verified : %d\n" "$verified_total"
105+
printf "Proofs not verified : %d\n" "$unverified_total"
106+
printf "Total spent (ETH). : %.12f ETH\n" "$eth_total"
107+
printf "Total spent (USD). : $ %.2f\n" "$usd_total"
76108
echo "----------------------------------------"
77109
)
78110

alerts/sender_with_alert.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ for proof in ./aligned_verification_data_$x/*.cbor; do
224224
echo "$message"
225225
send_pagerduty_alert "$message"
226226
verified=0 # Some proofs failed, so we should not send the success message
227-
create_log_entry "FAILURE" "Proof verification failed for $proof"
228227
break
229228
elif echo "$verification" | grep -q verified; then
230229
echo "Proof verification succeeded for $proof"

0 commit comments

Comments
 (0)