Skip to content

Commit 6cd9dbf

Browse files
committed
fix: send correct proof count
fix: send spent by aligned and spent total
1 parent a074767 commit 6cd9dbf

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

alerts/generate_send_summary.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ cd ..
2929

3030
batches=0
3131
submitted_total=0
32+
submitted_by_aligned=0
3233
verified_total=0
3334
unverified_total=0
35+
eth_by_aligned="0"
36+
usd_by_aligned="0"
3437
eth_total="0"
3538
usd_total="0"
3639

@@ -47,26 +50,29 @@ if [[ -f "$LOG_FILE" ]]; then
4750
| cut -d' ' -f1)
4851
if [[ -n "$proofs_submitted" ]]; then
4952
submitted_total=$((submitted_total + proofs_submitted))
53+
verified_total=$((verified_total + proofs_submitted))
5054
fi
5155

52-
proofs_verified=$(printf '%s\n' "$line" \
56+
proofs_submitted_by_aligned=$(printf '%s\n' "$line" \
5357
| grep -oE '\([0-9]+ sent\)' \
5458
| grep -oE '[0-9]+' \
5559
| head -1)
56-
if [[ -n "$proofs_verified" ]]; then
57-
verified_total=$((verified_total + proofs_verified))
60+
if [[ -n "$proofs_submitted_by_aligned" ]]; then
61+
submitted_by_aligned=$((submitted_by_aligned + proofs_submitted_by_aligned))
5862
fi
5963

6064
eth_spent=$(printf '%s\n' "$line" \
6165
| sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p')
6266
if [[ -n "$eth_spent" ]]; then
6367
eth_total=$(echo "$eth_total + $eth_spent" | bc -l)
68+
eth_by_aligned=$(echo "$eth_by_aligned + $eth_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l)
6469
fi
6570

6671
usd_spent=$(printf '%s\n' "$line" \
6772
| sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p')
6873
if [[ -n "$usd_spent" ]]; then
6974
usd_total=$(echo "$usd_total + $usd_spent" | bc -l)
75+
usd_by_aligned=$(echo "$usd_by_aligned + $usd_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l)
7076
fi
7177
;;
7278
*"FAILURE:"*)
@@ -78,26 +84,29 @@ if [[ -f "$LOG_FILE" ]]; then
7884
| cut -d' ' -f1)
7985
if [[ -n "$proofs_submitted" ]]; then
8086
submitted_total=$((submitted_total + proofs_submitted))
87+
unverified_total=$((unverified_total + proofs_submitted))
8188
fi
8289

83-
proofs_unverified=$(printf '%s\n' "$line" \
90+
proofs_submitted_by_aligned=$(printf '%s\n' "$line" \
8491
| grep -oE '\([0-9]+ sent\)' \
8592
| grep -oE '[0-9]+' \
8693
| head -1)
87-
if [[ -n "$proofs_verified" ]]; then
88-
unverified_total=$((verified_total + proofs_verified))
94+
if [[ -n "$proofs_submitted_by_aligned" ]]; then
95+
submitted_by_aligned=$((submitted_by_aligned + proofs_submitted_by_aligned))
8996
fi
9097

9198
eth_spent=$(printf '%s\n' "$line" \
9299
| sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p')
93100
if [[ -n "$eth_spent" ]]; then
94101
eth_total=$(echo "$eth_total + $eth_spent" | bc -l)
102+
eth_by_aligned=$(echo "$eth_by_aligned + $eth_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l)
95103
fi
96104

97105
usd_spent=$(printf '%s\n' "$line" \
98106
| sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p')
99107
if [[ -n "$usd_spent" ]]; then
100108
usd_total=$(echo "$usd_total + $usd_spent" | bc -l)
109+
usd_by_aligned=$(echo "$usd_by_aligned + $usd_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l)
101110
fi
102111
esac
103112
done < "$LOG_FILE"
@@ -106,12 +115,15 @@ if [[ -f "$LOG_FILE" ]]; then
106115
printf "Daily Proof Submission Summary\n"
107116
printf "From %s 00:00 to %s 23:59\n" "$DATE" "$DATE"
108117
echo "----------------------------------------------------"
109-
printf "Processed batches: %d\n" "$batches"
110-
printf "Proofs submitted: %d\n" "$submitted_total"
111-
printf "Proofs verified: %d\n" "$verified_total"
112-
printf "Proofs not verified: %d\n" "$unverified_total"
113-
printf "Total spent (ETH): %.12f ETH\n" "$eth_total"
114-
printf "Total spent (USD): $ %.2f\n" "$usd_total"
118+
printf "Processed batches: %d\n" "$batches"
119+
printf "Total Proofs submitted: %d\n" "$submitted_total"
120+
printf "Total Proofs verified: %d\n" "$verified_total"
121+
printf "Total Proofs not verified: %d\n" "$unverified_total"
122+
printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned"
123+
printf "Total spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned"
124+
printf "Total spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned"
125+
printf "Total spent (ETH): %.12f ETH\n" "$eth_total"
126+
printf "Total spent (USD): $ %.2f\n" "$usd_total"
115127
echo "----------------------------------------------------"
116128
)
117129

0 commit comments

Comments
 (0)